Dear @Khani,
Welcome back to the Wefugees Community and thank you for your question.
If you want to change the last name of your child and both parents agree on it, I recommend you to contact the responsible registry office (Standesamt) as soon as possible. As far as I know, you are only able to change the last name within the first three months after the declaration of custody ("Sorgerechtserklärung").
I hope this helps and all the best,
Meike