What resource group are you providing in the command to create the deployment?
az deployment group create --resource-group
This is the scope the deployment will be created it. You cannot create resources in 2 different resource groups in the same file just by using scope.
You should create a separate bicep file for creating the resources in the second RG and use that resource group name when running the command to create the deployment.