Hi,
My recommendation would be to go over the resources below and then you will have a nice overview on what needs to be done and how it needs to be executed in order to have a successful migration.
Please go over those and you will have your answers:
How to upgrade to SCOM 2022 step-by-step
Coffee Break: SCOM 2022 Migration
SCOM Upgrades demystified by Bob Cornelissen
I hope this helps! Let me know if you have any other questions.