File did not save

I wrote a little program in C to save some datas to a txt file. I post my code below:

void anyfunction(){
	FILE *fp;

	char *buf = app_get_shared_data_path();

	//char *buf = "/home/owner/apps_rw/org.example.uhrstruct/shared/data/";
	char *buf2 = "test.txt";
	buf = strcat(buf, buf2);
	fp = fopen(buf, "w");

	fputs("Hello", fp);


I think that should work fine, but the file did not save. I tried several different directions but it did not worked in any case.
I added these privileges:
Have somreone a idea what I am doing wrong?
Best regards, Marcel

Would you please have a look into this link? I think this question has the same query as yours.
Thank you.