try something like this:
function ErlingMove()
while 1 do
if(GetCurrentPlayer() == 'player number to which Erling belongs') then
if CanMoveHero(Erling, 15 , 9, 0) then
MoveHero(Erling, 15, 9, 0)
elseif CanMoveHero(Erling, 121, 22, 0) then
MoveHero(Erling, 121, 22,0)
end
end
sleep(2)
end
end