I want to create text file on client machine and then want to write in that file.
And while saving that file i want to ask user where he want to save file i.e. want to ask b
You cannot write back using JavaScript alone. You would have to perform a GET or POST call to be able to prompt a save.
Related question Read/write to file using jQuery