Create method for generating file