It's not meant to lock you in place.
Basically, when you put it in JPAN's walking script.
And for example, if you press A+B
It'll open the secret menu.
And it activates every step (So if you didn't press A+B that step, it won't work).
But, as mentioned before in his guide, the buttons have to pressed at the exact moment it's executed.
So by looping it, it'll be able to check if you pressed A+B. But it shouldn't lock you in place, since it's only checking if you pressed A+B. If you pressed anything else, the script won't even continue.