• Brainly User
Ants actually produce a type of smell while moving and all other ants follow the smell and hence the get in the line. They use that smell in returning again. You must have observed ants striking each other while walking to opposite directions. 

This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
When an ant find the sweet box it secretes a scent and other ant identifies the scent and follow the preceeding ant and then all ants starts moving in a straight line leading to the sweet box.Thus if one ant identifies or finds something to eat then the remaining also will follow the ant which moves forward and eats the food.