Sometimes they flee to the last waypoint. Sometimes in the direction of where they started the mission. Sometimes its virtually a random direction. Sometimes it is towards friendly forces.
However, it is always away from the enemy.
Sometimes they flee and just keep running. Sometimes they only go 100m and then rally and start to advance again.
A good idea is to setFleeing 1 the fleeing loons, to make sure they keep fleeing. Also, check if they can stand and if not either kill them or heal them a bit with setDammage. That means you don't get the crawling loon slowing up the game.
I have a feeling that fleeing units don't obey doMove commands, though don't quote me. You might prefer, when they flee, to give them setFleeing 0 and doMove commands.