Because now you don't have to worry anymore about how to capture output into a variable in the specific shell. This will make your script agent agnostic again!
The only required parameter is -name for the variable name. You can also specify the -isOutput and -isSecret flags to create an output and/or secret variable.
Only add the setvar task once in your pipeline to make it available on the agent.