completed insertion sort. problem in printing