What's happening is that the remaining two are getting scared and fleeing. Unit behaviour when fleeing is hardcoded: basically they head for somewhere they regard as "safe". I haven't experimented much but I think there are several possible locations. For example, they might head towards other, unfleeing loons. However, one place they always like is their start position.
In other words, you will find it hard to stop them fleeing back to their start position.
You could leave the teleport on a loop so that every time they go back to the start position they will get teleported again, though this might lead to them just running straight back there again.
Better would be to stop the fleeing in the first place. If you want to prevent it absolutely, use a command like this (syntax not guaranteed):-
"_x allowFleeing 0" forEach units grp1
Alternatively, increase the ranks of all the soldiers. Courage is related to rank, so the higher the rank of the group leader the less likely the group is to flee.
The Real Armstrong dug this out of the commented cpp in the Ed Depot.
courage[] =
{
0.20, //Private
0.35, //Corporal
0.55, //Sergeant
0.65, //Lieutenant
0.70, //Captain
0.80, //Major
0.90 //Colonel
};
};
In other words, don't have any privates in this group.