I'm not sure if a one-way rental car is possible, and it's likely not a good idea even if it is, as there's a lot that could go wrong.
Fortunately, the train is very comfortable and cheap. To get between those cities it takes between 30 and 35 hours if you were to stay on board the whole time, but most people touring the country stop at least 2 or 3 times in between at some of the other big tourist cities.
It's all explained on this page:
http://www.seat61.com/Vietnam.htm
The highlight in between those two for most people is Hoi An, which is a short taxi ride from the Danang train station. Hue and Nha Trang are also very popular stops.
There are also many bus services connecting all the big cities, and while they are a bit cheaper than the train, they are nowhere near as comfortable.