Welcome to the Wefugees Community and thank you for reaching out to us.
The paternity/fatherhood acknowledgement is usually declared at the "Jugendamt". As far as I know, they do not necessarily want to see you residence permit. But they want to see your passport or at least some kind of ID, your birth certificate, your registration (Meldebescheinigung) and the birth certificate (or for the time being alternative documents which prove the birth of the child). I am not sure if they would and maybe even have to report you to the immigration office when they find out about your legal status in Germany.
Another (more private) option is to go to the notary (he/she will charge you for the service though) for the declaration. Depending on the notary he/she will require different papers (which prove your identity at least) also.
However, the declaration of fatherhood will not save you in your difficult situation at the end. I would highly recommend you to consult a lawyer or to visit a migration counselling office, for instance. They will work confidentially and free of charge and you don't need to be afraid that they might report you to the authorities. Let us know if you need support in finding one close to your place.
Would you agree on this or is there anything you may want to add dear @alla_fka or @mbeon-Bernd?
In any case, please don't hesitate to get back to us with any further questions.
All the best,