output.good() just checks accessibility of the file. If it is not there yet, it will be created. Hence Captian Oblivious' comment that validFile never gets set to true. The reason the function ends is actually because you forget to close the first file before opening a second file(see here). That operation fails, setting the failbit. That's why your new file is never created, and your previous file gets overwritten.
I'm not sure of a great, standard, way to check for the (pre-)existence of a file in C++, but this sounds like what you probably want.