To take a flight to come to Germany you will have to have a visa. To do this you will have to book an appointment with the German Embassy in Tehran and apply for a visa for a specific purpose, either long term (for example as a skilled worker or student) or short term (e.g. as a tourist). It is not possible to get a visa as a refugee. Once in Germany, you can apply for asylum.
Here is information from the website of the Germany embassy about visa requirements:
The only other alternative I am aware of is via Germany’s humanitarian programme. This brings certain groups of refugees from other countries (not their home country) to Germany where they receive a residency status without going through the German asylum process. An example of this are Syrians who were resettled from Turkey in Germany.
Here is more information about these types of programmes:
I am sorry not to be able to offer any possibilities to quickly find refuge in Germany. Do not hesitate to contact my colleagues or me if you have any other questions.