Hi @Moro11,
I do not see any reason why the Ausländerbehörde would retain your passport if you are planning on leaving the country anyway. In my view, it is best to inform them that you have received a passport and can now leave Germany, as you are currently obliged to do.
The Ausländerbehörde can issue you with a paper called a Grenzübertrittsbescheinigung which you give to the border control upon leaving Germany. This confirms you have left the country and means you will not have any issues if you wish to enter Germany in the future. If you have not clarified the situation with the Ausländerbehörde before travelling, I do not know to what extent you will be questioned by border control when leaving the country, even if you have a valid visa and passport for the country you are travelling to.
You also need to inform the Sozialamt you are leaving Germany if you are receiving benefits (Leistungen) from them.
Best,
Éanna