Im not any kind of expert btw too but i dont see any node you setting your mouse is pressed. Also if im not wrong You dont need a branch there or even a while loop.
Loops also are very bad to use when you prees the a button or key action they mosty break cause the start to repeat the action thousands of time in a second and and the game get unresposive.
I suggest you to do something like that.
I just use to open a gate when the desired button is pressed. Use even tick on the gate entrance anc desired inputo on open close gate. You can also put an delay if you want to uppdate the function less frecuently.
Like for example moving the mesh 100 units every second or so