There are many errors in your code.
Below a working implementation. However, as it stands, it is still rather ugly: you have to complete (for instance you need to eventually release the memory) and improve it.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
struct list {
int data;
struct list *next;
};
struct list* insert(struct list* node,int data)
{
struct list* newnode=malloc(sizeof(struct list));
assert(newnode);
newnode->data=data;
newnode->next=NULL;
if( node )
{
while ( node->next )
node = node->next;
node->next = newnode;
}
return newnode;
}
void printlist(struct list* node)
{
if(!node)
{
printf("empty list\n");
}
while(node!=NULL)
{
printf("%d\n",node->data);
node=node->next;
}
}
int main()
{
int i,n;
struct list * first;
scanf("%d",&n);
first= insert(NULL,n);
for(i=1;i<9;i++){
scanf("%d",&n);
insert(first,n);
}
printlist(first);
}