Hi your code is right. You made a small logical mistake.. You forget to clear flag. I tried your code as it is with flag reset. It worked well.
if(flag!=1)
{
for(temp=startaddmul;temp->next!=NULL;temp=temp->next)
;
newnode=malloc(sizeof(struct node));
newnode->coef=tempmul->coef;
newnode->deg=tempmul->deg;
newnode->next=NULL;
temp->next=newnode;
}
else
{
flag = 0;
}