If your tasks are in an agent job, there is no need to use the output variable
section, just add a Powershell task after the successful task, you can overwrite/update the value of the variables by using the logging command to set the variables again in Azure Devops pipeline.
Write-Host "##vso[task.setvariable variable={variableName}]{updateValue}"
To set a variable from a script, you use the task.setvariable
logging command. This doesn't update the environment variables, but it does make the new variable available to downstream steps within the same job. In addition ,here is a reference.