Marrakech is a city in Morocco.
North towards Casablanca, Rabat
From the train station, walk north along the road following the signs for Casablanca in order to hitchhike. The city goes on for a long ways, but there is a wide spot in the road next to a petrol station where it is possible to thumb a ride to a wide spot in the road at the edge of the city.
West towards Essaouira
From next to the train station, take a bus L22 along the street Av. Hassan II (it costs around 60MDH). Get off when you see a big supermarket and a Afriqua petrol station on the right. It takes about 10 minutes and you're a bit outside the town then. There is a number of roundabouts and parking space, so the cars are passing slow. You can supply yourself in the nearby large supermarket. And the direction is clear, many cars will go to Essaouira.