Thanks so much for reaching out to the wefugees-community! I will try to answer your question in a general manner based on the limited information I have on your case.
Even before the child is born you and your boyfriend can reach out to the Jugendamt (youth welfare office) and recognize your boyfriend as the father. After birth your kid will automatically get the german citizenship and you can apply for a residence title with the purpose of raising a minor german citizen.
Since I do not know all the specific variables of your case I would advise you to seek help from an office specialized on helping refugees in your town or reach out to migration online counseling before taking the next steps.
I hope my answers were helpful and I would be very happy if you would contact me again with further questions. I'm a consultant with mbeon and I‘ll be glad to help you over a longer period of time. Mbeon is an online advice for migrants via the mbeon app, which you can install on your smartphone for free. Download it from App Store or Google Play Store. You can find me in the mbeon app and get confidential individual advice in a secure virtual space without other people reading our conversation. Further information: www.mbeon.de.