Dear @JMD_Hannah ,
You can stay in Germany and apply directly here with your local foreigner's office (Ausländerbehörde) for a permit according to § 24. The requirements are only that you meet the general requirements for Ukrainians that they were resident in Ukraine before February 24th 2022.
The Federal Interior Ministry of Germany has published a document about how such cases are to be dealt with. It makes it clear for the immigration offices throughout Germany that such movements to/from Germany and other EU countries is not a problem.
This is the document (only available in German):
I recommend you make reference to this document when applying for a permit, or to mention it if someone is helping you with this.