Flatten multi level linked list