Thank you for your query.
Your child has probably claustrophobia
or train phobia.This is very common in her age.Don't panic.Take some simple steps. Acclimatise her by taking her on local trains. Get down after one station,if she tolerates this increase the number of stations each time to familarize her with the train journey. Make her train journey interesting.Take some story books or video player to keep her distracted. If serious need occurs and you have to travel in a train ,ask your doctor for a mild and save sedative for the journey.Hope it answers your query.Have a nice day