Code to sort a input text file