In a nutshell, this isn't a problem as long as you declare your variables at the start of the script.
In more detail, what you're asking about is called the "scope" of variables.
It all depends on where you declare the variable. You don't have any declarations in your example. For example,
object TokenToMove;
is a declaration.
Normal practice is to declare variables at the start of the script. In that case, any reference to the variable, whether inside a loop or not, is unambiguous, so the change to TokenToMove will be remembered for the duration of the script.
You can also declare variables inside a block of code, such as a loop. For example,
while (Randomizer !=0)
{
int TokenToMove;
TokenToMove = GetNextItemInInventory(TheBox);
Randomizer--;
}
In that case, the scope of the variable is only inside the loop. If you also declared TokenToMove at the start of the script (which would be necessary to avoid a compiler error), NWScript behaves as though you have two variables, TokenToMove1 outside of the loop, and TokenToMove2 inside. So, the change to TokenToMove inside the loop would not affect the value outside of the loop.
Some scripters prefer to declare all variables at the top of the script, to avoid this confusion. Arguably, in a very long script, it's easier to understand if variables which are only used in one block are declared there, but it's potentially dangerous.
When a script stops, all variable values are forgotten. If you need to refer to a variable when the script starts again, or in a different script, use local variables on an object.