Thank you for your explanation.
The refugee passport is normally only valid as long as you have a valid residence permit. If this expires, you need to apply for a new passport accordingly, as there is no opportunity to extend it. I would recommend to apply for the new passport at least 2 or 3 months before expiry. For details on the application (in this case for Berlin, but I assume it will be similar in other cities), please see this website.
I hope this helps and all the best,