Unable to write on SD the same data showed on serial monitor

Do you know how to write to a file on SD card? If not, start with that. If yes, duplicate your code and instead of using Serial, use the file handle returned by SD.open().