added the code which reverse the list in groups of k to the orginal list