eyeglasses on opened book beside cup of coffee on table

How to append in a CSV file using Apex

Feel free to utilize this method and change as per your need:

public static void appendToFile(Id fileId, String base64Data) {
    //base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
    ContentVersion csvFile = [SELECT VersionData FROM ContentVersion WHERE Id = :fileId];
    String existingBody     = EncodingUtil.base64Encode(csvFile.VersionData);
    csvFile.VersionData = EncodingUtil.base64Decode(existingBody + base64Data); 

    update csvFile;
}