Updated ngram_sorter code to correctly output to stdout/file depending on launch arguments