How to dynamically update sfdcLoginUrl value in sfdx-project.json file

I have two stages in my CiCd pipeline: UnitTesting and UAT.

For Unit Testing, I want to deploy my changes in a Scratch Org. For this sfdcLoginUrl value in sfdx-project.json file should be “https://login.salesforce.com”.

For UAT, I want to deploy my changes in a full copy sandbox. For this sfdcLoginUrl value in sfdx-project.json file should be “https://test.salesforce.com”.

Since I want to execute these stages automatically, is there a way to to dynamically update sfdcLoginUrl value in sfdx-project.json file.

-Thanks