To append text to a file, you can use the a mode (append mode) while opening the file:
/*
Example: append new text to file in C language
*/
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *filePointer = fopen("test.txt", "a");
fputs("new added text", filePointer);
fclose(filePointer);
return 0;
}