You may want to have a case structure inside of your while loop. You can have a stop button from your front panel stop the while loop. Inside the while loop, you can have a case structure which only executes if "so much time" has passed. Inside this case statement, you can write the data to a file.
To determine when "so much time" has passed, you can use the "Wait Until Next ms Multiple" VI to know how much time has passed. For example, if your while loop is set to execute every 100 ms, then you know that every 10 loops is 1 second. Using this, your case statement can determine how much time has passed and only write data to file when you want to.
J.R. Allen