Is there an Inyan not to go on the first or last train cart?
To the best of my knowledge, there is no Torah source about this matter. It stems either from superstition, or the fact that some people think the first and last car in the train are less safe in the event of a collision. The facts, however, are that most accidents from train rides are associated with derailment rather than collisions.
It’s best not to try to outsmart the system and rely on Hashem while taking proper safety precautions and always traveling as per Torah guidelines: learning Torah on the way, reciting Tefillas Haderech where relevant and taking along Seforim and a Tzedaka Pushka.