No need for a for loop, the following code will save the data for us in an excel file:
std::ofstream outfile;
outfile.open("Real-Time.csv", std::ios_base::app);
outfile<<TotalTime<<", "<<os.str().c_str()<<", "<<os1.str().c_str()<<endl;
outfile.close();