Hello Singh we welcome you to the platform,
You can get the Custody before child is born , bit its always advisable to do it from 7 months to the childs delivery. If you are already legal then u hv to get appointment at the Standesamt , cox they would ask of your address , resident permit or Duldung, with Notar is much more safe if one is illegal. I hope this would help . Don’t hesitate to get back to us if you have more questions.