Hi Rohan,
I understand that you are facing error while working on Simscape battery Onramp course.
The following error "Error:Connection Port block 'SimscapeBatteryOnramp/NewPack/ModuleAssembly2/AmbH' expects a 'foundation.thermal.thermal' Simscape domain, but is connected to a different type" is encountered due to wrong library block.
To resolve the issue, you can double click on the error and it will redirect to the wrong library. The input is expected from foundation.thermal.thermal' Simscape block.
Another workaround is to delete the block and rebuild the model by inheritting foundation.thermal.thermal' Simscape block from Connection Port block 'SimscapeBatteryOnramp/NewPack/ModuleAssembly2/AmbH'.