There are many ways for you to buy a train ticket in Vietnam: buy directly at train stations or book online through tourism websites.
The traditional method is to buy directly at train stations. It is easy to purchase the ticket this way because all you need to do is to come to stations, check the information about your desired trips in the board and then buy tickets from the tickets sellers. The disadvantage with this way of purchase is the sometimes long queue. Also, train ticket sale agents do not always understand English so you should write down of your desired destination just in case. The advantage of buying the ticket off the counter is cheaper price.
A more convenient method is to book online through tourism websites. There are several websites that support booking train tickets online with English interface or private travel companies. But it will be better for you to ask your tour agency for booking train tickets because they are quite familiar and experienced in this work.