Added setnext() function to ListNode class