Welcome to the Wefugees Community and thank you for reaching out to us.
As father of a German child, you might be able to obtain a residence permit according to section 28 of the German Residence Act. We discussed a very similar question on this platform before. You may want to follow this link for more information.
As you mentioned already, declaring the fatherhood (Vaterschaftsanerkennung) and the shared custody (Sorgerechtserklärung) will be essential steps. However, as you are currently staying illegaly in Germany, the procedure can get quite difficult. The authorities (mainly the "Jugendamt" in this matter) may report you to the immigration office/police as soon as you approach them. Contacting a notary for the declaration could display an alternative. Please see also this thread for more details on this topic.
I would highly recommend you to get in contact with a lawyer who can support you.. Would you agree and/or is there anything you like to add dear @manrhei-mbeon or @mbeon-fardeen?
In any case, please don't hesitate to get back to us with any further questions.
All the best,