ESP32 saving data to SD card in .csv doesnt format correctly
In Arduino SD library FILE_WRITE constant instructs the function to open the file for append, but in the esp32 SD library it opens the file for rewrite. Use FILE_APPEND to open the file for append.

File file = SD.open(path, FILE_APPEND);