First of all: You didn't post the contents of the COMMANDS.txt.
What is the refresh rate? 1000?
The second code part will not work accurately because you need some time to write the data to the SD card too and that's not calculated into the refresh rate.
Change this
if (currentTime > lastReadTime + refresh_rate) {
to this
if (currentTime >= lastReadTime + refresh_rate) {
to not loose a millisecond in every refresh loop. Also set the new value of the lastReadTime first in the if-block and not after you wrote the entry (you need some time to write to the SD card).