i'm actually trying to do another code

Code:
void saveinfo(ptrcourse *pFirst, ptrstudent *pHead, int ctr[])
{
     FILE *pFile;
     char filename;
     ptrcourse current;
    current = *pFirst;
	pFile = fopen("mp.txt", "wt");
	if(pFile != NULL && current != NULL)
	{

          
      
          fprintf(pFile, "%s %d\n",current->coursecode,current->section);
          
          fprintf(pFile, "%s %d:%d-%d:%d %s\n",current->schedule,current->ptrtime.shr,current->ptrtime.smin,current->ptrtime.ehr,current->ptrtime.emin,current->lecturer);

          fprintf(pFile, "%d\n",current->slots);

          current = current->pNext;
          
          fclose(pFile);
          }
}
it's this one
it is already writing something but it is just the first node.
What should I use to replace current = current->pNext;?
thank you for all your suggestions