Just a hint before we give the real answer.

This line is always true so there is no reason for the script to end.

While $UID[0]

Answer typically has to do with errorlevel checking.