Help me in solving PPSC274 problem

My issue

run time error

My code

void userFunction() {
    
    /* Initialise the character pointer and open the respective files in the correct mode */
    char *inputfilename = "/mnt/codechef/input.txt";
    FILE *inputfile = fopen(inputfilename, "r");
    char *outputfilename = "/mnt/codechef/output.txt";
    FILE *outputfile = fopen(outputfilename, "w");
    
    int number;
    
    // Read and write the numbers from the file
    while (fscanf(inputfile, "%d", &number) != EOF) {
        fprintf(outputfile, "%d\n", number);
    }
    
    // Display contents of output.txt
    fclose(inputfile);
    fclose(outputfile);
    
    system("cat /mnt/codechef/sample_output.txt");

    
}


Learning course: Programming and Problem solving using C
Problem Link: https://www.codechef.com/learn/course/ciet-programming-c/CIETPC37/problems/PPSC274