@Mijaz
Here is your command, copied & pasted into triple-backticks here on this forum so that we can actually read it:
process1.start("echo /sys/kernel/iio/devices/iio:device4/ 0x418 0x2 > direct_reg_access");
So, this will put the characters
/sys/kernel/iio/devices/iio:device4/ 0x418 0x2
into a file named direct_reg_access.
Now, as I have said before, this will create/overwrite that file in the current directory of whichever process it is run from. Why do you need any special permissions?
Please log onto your Linux or whatever box, open a shell/terminal, and copy & paste the command you have written into it as the very first thing you do in the shell:
echo /sys/kernel/iio/devices/iio:device4/ 0x418 0x2 > direct_reg_access
Do you agree this works immediately, without any special permissions? Because your current directory is highly likely to be your home directory, and you have permission to create/write to files there. So, you don't need any special permissions, do you?
Now, if it turns out that what you really mean is that you want to write to that file elsewhere, then you have to say so. I don't want to have to guess. Perhaps what you really mean is
echo /sys/kernel/iio/devices/iio:device4/ 0x418 0x2 > /sys/kernel/iio/devices/iio:device4/direct_reg_access
While we are here. Your question #2 , copied & pasted, says what you intend to do is:
cat /sys/kernel/iio/devices/iio:device4/ direct_reg_access
This will always error, because you cannot cat a directory. Try it yourself from a shell. I asked you before to look at your spacing and correct or tell us what you actually want to do.
Finally, the whole process you have written is pointless. At the end of it, if you cat the direct_reg_access file you have created you will always get back precisely the string
/sys/kernel/iio/devices/iio:device4/ 0x418 0x2
so what is the whole point of the exercise?
I will answer your question about permissions if you take the time to make clear what it is you actually want to do, where that file direct_reg_access is supposed to be, but not before....