display final output in sorted order