create single linked list from head and end