I did test it for you information. Your script is bugged. When it writes the file it writes it as a "File" not a "txt" as you have it reading from. Also, your output messages are a little bugged as well.
(blank space) was added as invite channel.
If you took a little time to read and test your script properly you would catch these easy errors. Anyways, I hope that gives you something it think about.