Whenever you do file-io from CGI scripts you can never
trust relative paths. Try putting the full-path
to where you want
wrfile.txt to be in both
programs.
Also you should check the error returns from the "open"
in both scripts or you could miss errors.