Giving the file a valid extension will create that file. But the real question would be contents of the file. If you put valid html in a .html file than it is all fine but the moment you go ahead and start creating .exe files you will have to think how valid it is since you can not put a valid binary data in it.
So the answer to your question is yes but be careful about the file type you create.
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.