Method to reverse a linked list iteratively