Der Hut flog mir vom Kopfe
I understand, that you have problems to understand the meaning and grammatical function of "mir" in this sentence, and you are not sure about the exact meaning of "flog".
Before that, I just want to point out, that "Kopfe" is just an old dative form of "Kopf". The modern dative is "Kopf". Another thing: "vom" = short for "von dem" (you have such short forms in English too: "don't" = "do not"). Now you can read this sentence as:
Der Hut flog mir von dem Kopf.
This is a form of "fliegen". This word does not only mean "to fly". I can mean almost all other forms of "move through the air". In combination with "davon" (away) one of this meanings is: to be blown away by the wind:
Das war ein Sturm gestern! Sogar das Dach unseres Hauses flog davon.
This was a storm yesterday! Even the roof of our house flew away.
What a storm yesterday! Even the roof of our house was blown away.
Sorry, English is a foreign language to me, so there might be an even better English version
In some regions you can also hear in colloquial speech in combination with "herunter/hinunter" (down) or similar constructions:
Halte deinen Teller gerade, sonst fliegt dir noch das Essen auf den Boden.
Hold your plate strait, otherwise your food will fly to the ground.
Keep your plate strait, otherwise your will drop your food.
Mir fliegt der Hut davon.
Dir fliegt der Hut davon.
Herrn Müller fliegt der Hut davon.
- der Hut
The subject of this sentences is always "der Hut", because it is the only part of speech in nominative case. It is the thing that performs the action. (Who/what is moving through the air?)
The verb. It tells us, what the action is (something, i.e. the subject, is moving through the air)
This is a direction. (Where-to is the subject moving?)
- mir, dir, Herrn Müller
me, you, Mr. Müller
This part if speech is in dative case and tells us from who the hat is flying away. It is both: the starting point of the movement and the owner of the subject.
You tried to translate this "mir" as "to me", but this is wrong. "from me" would fit better here.
Der Hut flog von meinem Kopf weg.
This is grammatically correct and means: "The hat flew away from my Head". But this sentence does not tell who's hat it was. It tells us only the starting point of the movement, but doesn't tell anything about the ownership. It might be anybody else's hat, that flew trough the air, passed my head, and then kept flying, but now away from my head.
Der Hut flog von mich vom Kopfe.
No, this is wrong. The preposition "von" always needs dative case, but "mich" is accusative case. So you might try:
Der Hut flog von mir vom Kopfe.
Better, but still wrong. You can say:
Der Hut flog von mir (weg).
The hat flew (away) from me.
(To have a complete sentence, you need the adverb, that I wrote in brackets, in both languages)
Here "von mir weg" is a prepositional object, and it is a direction (where-to is the head flying?). But "vom Kopfe" (or "von dem Kopf") also is a prepositional object that is a direction. Two direction is one direction too much.
Ich wendete mich nicht
This is simple. It is:
I didn't turn myself.
I didn't turn around.
My hat flew into darkness,
I did not turn to see.
In poems the rhyme is very important, and in lyrics you also must find the same rhythm. In most cases it is impossible to find a translation, that rhymes, has the same rhythm and transports line-by-line the exact same meaning.
The best you can do, is to find a translation, that rhymes and has in most lines the same rhythm. The meaning must only be close to the original, but not on a line-by-line level, but within the whole poem.
In the German Version of this line there is no darkness (Dunkelheit) and nobody is seeing something. But the darkness is in verse 2 (this line is in verse 3), so it's ok to use darkness here. "To see" (in the meaning of watching the flying hat) is an invention of the translator that doesn't exist in the German text. But here, in this poem, it is ok too, because what else might be the reason to turn around? This "to see" is already implicit contained in this line.