Task variable vs process variables

Hi,
I want to update the variables. As I see in RestApis there are 3 endpoints for variables.
process-instance->variables->Modify
task->variables->Modify
execution->variables->Modify
I call all of them and in the Cockpit when I check the variables, they change after all of them. And also their changes return in variable history APIs.
I read the difference is about variables scope, but I do not get it what are their difference in practice? I create a process instance with some variables and in each step some variables added.
I appreciate it if someone could help me which restApi should I use for updating variables?

Thanks