Saves data depending on user choice

Saves data in the format user wants. In next commit, newline character
bug will be resolved.