Flattening Linked list