I don't even have to look at your code to answer your question.
No matter what you do, you cannot affect anything in the media directory.
Any and all write operations end up in the appropriate sandbox for the platform. In Windows it is Documents\AGK\<yourapp>\media.
If you write a file with the same name as one in the media directory, the next time you go to read it it will be read from the sandbox area.
Open operations for reading/loading always check the sandbox area first, then they check the media directory.
Open operations for writing/saving only work in the sandbox area.
Now, I just looked at your code. The commands you are using for writing are the binary versions. So, when you do find the file in the sandbox area, it won't be human readable. If you want a human readable file, you can only use WriteLine.
Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master