As the man says, you need special plates "Ausfuhrkennzeichen".
The German Auto club
www.ADAC.de has lots of info on this - but only in German.
You must have "halbpflichtversicherung" - the appropriate insurance.
The best place to buy a used Merc. in Germany is probably Hamburg.
I cannot see why a foreign resident should have any problems as long
as the rules in Germany are complied with!
Very cosmopolitan and a big new and used car export centre (via ships).
The local authority has a dept. which deals with these things - Strassenverkehrsamt
or similar. (Try German
Google - Strassenverkehrsamt hamburg., for the address(es))
You might even find they have an English speaking employee if you visit...
You will also need to check if you are OK travelling through Turkey and Syria -
you might need visas (certainly for Syria).
Turkey has rules over temp. imports of cars.
Hamburg is good for consulates, so another reason to buy there.
I'm pretty sure you are OK travelling thru Hungary, Rumania and Bulgaria,
but you need to check.
I've seen the German Customs being very fussy about a car with "Ausfuhrkennzeichen"
leaving the country - but now with open borders (Schengen) you should not have any probs.
until crossing between Hungary and Rumania.
Stick to the rules in Germany and you are OK - else you can get badly bitten!
Germany is a good place to buy used cars -make sure it has a recent TÜV and AU
(2 yearly test and yearly exhaust check).
The TÜV and AU are Germanically thorough...