Post an example of your code would help, but in the meanwhile I will guess.
It sounds like you are not saving your data until after you exit the loop.
This can be done a number of ways. I would suggest you use a shift register to save your data from one iteration to the next. In your TRUE case, use a build array to add the new data to the shift register. In the false case, just pass the shift register contents through without modifications.
This should allow you to pile up all your data until the end when it is time to write.
This is not the most elegeant way of doing this task (i.e. large data collection sets will quickly fill memory) but it should get you started.
Ben