If the contents of your file are getting removed entirely, check that you have the command set up correctly.
"~fileContents" need to be set to, as the name suggests, the contents of the file you're writing to.
The value of "~textToInsert" will be inserted (again, as the name suggests) into the file, so you need to set that variable to the appropriate value.
To get a number from a spoken phrase, you can look into the "{TXTNUM:}" and "{CMD}" tokens.
Again, read the documentation on the features you're trying to use.