You've got a serious data flow problem in that tiny picture of your code. You need to look over the LabVIEW tutorials again.
Start by getting rid of that inner while loop.
It is impossible to help more since you didn't attach your VI so we can see what is really going on in the rest of your VI.
As RavensFan said, you need serious dataflow change, you have wires going all over the place. Generally it's frowned upon if the wire goes backwards (unless you are using feedback node or similar).
You should open file only once, at the start of your program, and then write to it and close when program stops. What you are doing here is opening the file on every loop, write a glob of data into it and then close it.
The way you concatenate strings together you just get a single string out, no spaces or line breaks or anything, that file will be very hard to read.
EDIT: just noticed that you also use empty error constants before each IF, that does absolutely nothing and should be removed.