As mentioned by OriginalGriff in
this thread[
^], what you are trying to do will cause the text file to open on the server (if allowed) in notepad.
This won't be visible by you, how could it be?
You say 'This is working fine before publish the website', but think about it.
Before publish, it's running on your machine so when you start the process it's visible to you. After publish, its running on a remote machine!
Instead, what you need to do is read the input from the text file, then display it on a page in your site