Buying a vehicle in Morocco would require you to have ( شهادة الاقامة ) or Certificat De Résidence - certificate of residence. That can be obtained at the المقاطعة Arrondissement (district) where the person lives.
One option would be to find someone you trust to put the vehicle in his or her name, and then they prepare for you a وكالة / Procuration (power of attoney). This would allow you to drive legally everywhere in Morocco. If you decide to go this route, let me know and I'll provide you with one I have drafted, used and that worked.
Only issue is if you crossing borders, I have read that different countries have different reactions to vehicle being driven by people who don't own them. I read that as long as you have a Power of Attorney they can understand you re good. I'm happy to provide you with French and English translation of the Arabic POA as welll if that helps. goes without saying you have to have them stamped locally by the Arrondissement المقاطعة .
As far as buying trucks or cars there, I would recommend against it. They are extremely expensive and this is due to a protectionist import policy imposed by the government. There is a high import tax on cars, motorcycles and trucks. Only exemption is given to farming machinery. So if you want ride a tractor you may get a deal... :P
Bottom line, used cars, you don't get a lot of car for your money. Maintenance is generally poor. People in general are less meticulous about doing stuff recommend by the manufacturers. Cars that are in great shape are very expensive compared to Europe.
Otherwise you can buy a new one, a little van like Fiat Doblo has a small turbo engine very good car is about $11 000 / 10 500 euro brand new. Very practical vehicle. Can sleep in. Solid, reliable and very gas efficient (runs on diesel). has a common rail engine. You can sell it after done for good money.
Netherlands, France, Germany and Belgium are countries I know for fact have procedures for quick export of vehicles. These are countries with a lot of people and a lot of cars and they have policies in place to facilitate getting rid of cars.
Germany for example provides an export plate you pay for about $160 that includes both registration and insurance at once. Google Germany Export Plates. France has something called
Certificat Provisoire d'Immatriculation (CPI) with WW plates. see here
Immatriculation provisoire WW pour les particuliers
Spain would be the most convenient due to geography but i think it is a country where things happen slowly...and their procedures are unclear based to my research.
Good luck!