What do red ants secrete while marching in a line, one after the other?
The simple answer is that ants secrete a substance called trail pheromone as they forage for food and each ant follows the trail of trail pheromone that is laid down by the preceding ant. 

The term 'trail pheromone' can be a bit indistinct, however. Rather than consisting of a single chemical, trail pheromone is composed of many different chemicals, the exact compositions of which appear to be used deliberately to deliver complex information about the details of a given foraging site. 

In the linked paper, the authors suggest that the 


  use of several trail pheromones that differ in their persistence
  provides memory over differing time scales. In particular, a
  non-volatile pheromone can provide a longer-term memory, while a
  volatile pheromone can allow rapid choice among potential feeding
  locations by quickly ‘forgetting’ depleted locations.


This means that ants may be able to use pheromones to assemble a sort of "collective memory" for the colony, concerning the locations of food and the quantity of food found at each location.