You need to unlink the found entry from the list. So before you set the next element (line 37) you need to save the current. After the loop is done you need to set next of the saved entry to null[ptr].
while(temp->next!=NULL) // This will crash if head==NULL
if(saved) // if saved exists: saved->next != NULL due to while(temp->next!=NULL)
else // if saved is actually NULL it is head
Yes, but when you delete the last entry, the entry before last becomes the new last. Therefore you must change the entry before last's next pointer to null to indicate there are now no more nodes in the list.
You have another problem in deleteend(). What happens if head is null (the list is empty)? Hint: The use of temp->next is not valid.