This is the best I can think of, as I havent been near my file-handling code in a while.
And Im not in a very "coding" frame of mind ATM, so following your code isnt working.
Can your code find the data you want to remove, and its length in bytes?
If so, then follow these steps with my code to remove that 'chunk' of data.
// Close the file in your code.
var LENGTH = [the number of bytes to remove];
var START = [the position of first byte to remove];
// ( the number of bytes from the start of the file ) //
var fhandle = file_open_RW(filename);
file_bytes_remove(fhandle, LENGTH, START, 0);
file_close_RW(fhandle);