put the following in your void setup()
if (!sd.begin(chipSelect, SPI_FULL_SPEED)) sd.initErrorHalt();
ofstream sdout("test.csv", ios::out | ios::app);
your just opening the same file over and over again
and no its not the only way, there's a write() function, post your full code