I can't see the other cases, so I can't really debug your code. So instead, I wrote an example that should work. It's set up with it's own while loop, so you can add it anywhere outside the Basic Robot Main vi. Feel free to put parts of it somewhere else, or incorporate it with your RobotData.
It's basically a state machine. In the first state you can move the motor both left and right until you hit a limit switch. Then you're limited to going the other direction or stopping if you go the other way. Once you hit the other limit switch, it's vice versa.
I hope this helps you. Check out the lvmastery video on
State Machines. I found it to be very helpful. Good luck!