1) First, draw whatever you want to be used as a stroke. In this case, I will drew an ant.
2) Select the paths with the selection tool and go to Object > Stroke > New Stroke Definition
This will open up a new tab that look something like this
3) Select everything with the selection tool and right click. You should see this:
This gives you the option to anchor the image and make repeating. In my case, I want the ants to repeat, so I select that.
4) File > Save
Give your stroke an appropriate name.
That’s it. Now you should be able to use your stroke in your designs.
With this new stroke, I can now make a line of ants following whatever path I want.
I hope this helps! Have fun!