Well, you are replacing text in a snippet extracted from the file, not in the file itself. The snippet may represent a small part of the file content. If you write the snippet with the replacement back, you will likely lose a large portion of the original file. And if the original file was anything other than .txt (eg it was a PDF or a word doc) you will lose all of that.
You can use a stage to copy a field into a stream and then give that stream to the write action. But as I said above, I doubt this is what you are after.