delete function for linked list