Dear Srini,
I am sorry to tell you that your code is a good example of what we call "racing conditions".
This means that you designed your VI in a way you cannot be sure in what order LabVIEW will execute your code. Remember LV is not "reading" from left-top to Right-bottom your VI. It tries to run everything that is not interconnected at the SAME time. (It is not exactly the same time but kind of).
In order to be sure your actions will occure in the right order, there are 2 ways to do it :
1 - Use a sequence with each action in a separate frame
2 - Interconnect VIs (with error cluster for example).
Once you will have done this, your VI will run as you expected.
Doc-Doc