It's my understanding, from reading various sources, that the steam locomotives were not used close to the front, since their smoke plumes tended to attract enemy artillery fire. The final moves to the front line were handled by the gasoline locomotives. That said, since the men on the train in the movie were neither wearing helmets or obviously bearing arms, the train is well behind the lines.