This is shorthand for
i = child(player);
while (i ~= nothing) { move i to room_name; i = sibling(i); }
a little bit of thought will show you why this doesn't do what you want.
One solution that works is:
while (child(player) ~= 0) move child(player) to room_name;
-- Gareth Rees