permissions – Raspberry Pi 5 Unable to redirect script output to file

I’m using a Pi5 to run raspotify (a service that allows you to connect spotify from another device) it also starts a script “MyScript”.
I want to redirect the output from MyScript to a file but I get Permission Denied (I checked journalctl)

So in my script I have: echo "Some Text" $A_VARIABLE >> myfile.txt

If I ls -l myfile.txt it is already set to -rw-rw-rw- pi pi
I don’t know which user is running MyScript, it is launched by raspotify.
Can anyone advise why I get permission denied when I thought I’d set it so anyone can write to it?

Read more here: Source link