Your Ukrainian passport or ID card is your ticket! Just show it an you can use all local and regional trains or buses for free! That includes regular buses, streetcars, light railroads, subways, and regional trains such as Regionalbahn (RB) and Regionalexpress (RE).
Long-distance trains like ICE, IC, EC, Flixtrain (FLX) as well as long-distance buses such as Flixbus, Eurolines, BlaBlaBus are not free of charge. Flixbus is providing free rides from Ukraine, Poland and other countries to Germany, though.
BUT: There is an exception – German Railway (Deutsche Bahn/DB) has made it easy for Ukrainians to take long distance trains to travel to Berlin, Dresden, Nuremberg or Munich. You just need to proof you are from Ukraine.
If you want to travel further than these four cities, DB will give you a free helpukraine ticket to your destination. The ticket is valid for travel in second class and is available from a DB Reisezentrum (travel centre at a station) or a DB agency (in the train stations). When you are on a train, please show your Ukrainian document during ticket control.
Additionally, you can currently reach even other EU countries like Belgium, Denmark, France (ICE, TGV and Thalys), Luxembourg, Netherlands, and Austria.