There are two solutions to your problem and the right one depends on the complexity of your program.
The first is to have two separate loops. One does the counter update and runs at the fast speed. The second loop does the writing of the file and runs at the slow rate.
The second is to have one loop that runs at the fast speed so you to the counter update. You keep track of the time in a shift register and if an appropriate amount of time has passed (e.g., one second), you write to file. Meaning the file write is inside a case structure that's controlled by the "how much time has passed" check.