Flatten a multi level linked list