I have to book a return ticket from Iran to be allowed to enter, so I need a reliable tourist agency or another way to book a train ticket from Tehran to Damascus. The booking will have to be confirmed in writing and it has to happen fast. Any tips?
Order your tickets through this page: Iran transport services.
But anyhow, to enter Iran and get a 30-day on arrival visa you will not be asked to show your departure ticket or any other document showing that you will leave Iran.
If your nationality is among the countries authorized to get a 30-day on arrival visa (except USA, England, Canada, Colombia, Pakistan, Afghanistan, Iraq, Jordan, Bangladesh, and Somalia) you can easily collect you visa against offering your passport, a passport-size photo and about 10-150€(depends on the nationality).
And if your visa is a pre-arranged one, be sure that no one will ask for your departure ticket.