Dear @Liza,
Welcome to the Wefugees Community and thank you for reaching out to us.
You may find many relevant information on this website of the German government as well as on the "Handbook Germany" page (both sources also in Ukrainian). The German government writes:
"Until further notice, you won’t need a ticket to enter Germany by train; a Ukrainian passport or corresponding Ukrainian ID document is sufficient. For onward journeys on long-distance transport, you can get a “helpukraine” ticket in DB travel centres (located in train stations) free of charge. Ukrainians do not need a ticket to travel on local German public transport."
I hope this helps and please don't hesitate to get back to us with any further questions.
All the best,
Meike