Teresa,
A state machine is a while loop, with a case structure inside. The loop executes repeatedly, until the "exit" state sends a "stop" to the while loop.
I am in the process of reviewing your code, and will email the results to you. I wanted to post here because this may be a common problem.
You can also go to the Topics section. There is some discussion there about program designs, which a state machine is. There is a sample posting there of mine that is kind of a state machine (with execution and reiteration controlled outside of the program, by a caller.) This will give you something of an idea.
Additionally, you can search NIs website for examples of state machines. These are prolific designs, and you should be able to find one.
If
you cannot, please let me know and I will create a simple example and place a copy on the design discussion Topic on this site.
Good luck.