prints elements of linked list