Building train track in game

what you need can be easily achieved with splines and then move an object (in your case the train) along its path.
there is a rollercoaster plugin already available open source that you can have a look at