You cannot save a file directly to the users machine, in an HTTP web environment you do not have access to a users file system and no user would want you to have that ability either. Having created the file on the server you need to give your user a link to click or redirect to a download page for that file, and let the user save it to their file system.