Send data to Editor before saving the post

Assuming you refer to the WP main editor, you can get the TinyMCE instance with

var mainEditor = tinyMCE.getInstanceById('content');

then clear the current content with:

mainEditor.setContent('');

and add your new content

mainEditor.setContent('we are the borg lower your shields and surrender your ships');

If the new content doesn’t get saved, call

tinyMCE.triggerSave();

additionally.