You have to grab the side/back of the train, depending on which "Compartment"(IDK whether this is the right word or not -_-) you grab. You can enter the train by grabbing the side at the 2nd "Compartment" and the back at the last "Compartment". Even so, it's best to just wait for it to stop, it's hard to actually grab it while it's still moving.
*Where the Train stops*
*The route the Train takes*
I have also draw the route the Train would take and where it would stop, just in case you didn't know.