you can open the file in setup and then write to it on every update like:
//.h
ofFile myTextFile;
//setup
myTextFile.open("text.txt",ofFile::WriteOnly);
//update
myTextFile << "some text"
if you need to open a file to append to it instead of overwrite it's contents then you can do:
ofFile myTextFile("test.txt",ofFile::Append);
myTextFile << “my text comes here”+”\n”;