Updating reverse function in linked list