This is very easy and fast way of drawing settings icon. You need only the star tool and change the live corners > chamfer type. Depends on your need you can make a hole in your star shape.
Here is the video showing how to create cogs wheel icon:
illustrator gear logo design | cog wheel or setting icon