Leaving Hearthome City in Pokémon Diamond and Pearl is easy once you know your options—there are actually three ways out.
As you enter, you'll notice another transportation building you can use. Alternatively, you can simply backtrack the way you came in. And finally, there's an exit on the opposite side of town. Any of these three routes will get you on your way to the next area.