Put this file in the same folder as the text file to write to.

Make a backup copy of the text file to write to (unless it is a new one).

Set the 'Send to / File name' in the form's properties to the filename
for which you want to set the write permission, preview this page in
the browser and click 'Submit'.

Afterwards, open the file and delete the 'submit' line(s) at the end.

If the file is corrupted, just re-import the backup copy and allow to
overwrite (this usually keeps the permissions set).