c – Why doesn’t the linked list program print anything? Can the code in my insert() be shorter?

it only prints 5 which is the first node.

If there’s a better way to implement a linked list, that might be what I need.

(order of the below linked list is sorted by value)

#include<stdio.h>
#include<stdlib.h>
typedef struct node{
    int value;
    struct node* next;
}node;

node* first=NULL;
node* last=NULL;

void insert(int value){
    
    node* temp2=malloc(sizeof(node));
    temp2->value=value;
    
    if(last==NULL){
        first=last=temp2;
        temp2->next=NULL;
        return;
    }
    node* temp=last;

    while(!(temp->value<value && (temp->next->value>value||temp->next==NULL)))
        temp=temp->next;
    
    temp2->next=temp->next;
    
    if(last->value>=value){//if the value is the smallest
        last=temp2;
        return;
    }
    temp->next=temp2;
}
int main(){
    insert(5);
    printf("%d ",last->value);
    insert(3);
    printf("%d ",last->value);
}