I recently did an upgrade from 5 to 7, the only way to do it is one version at a time.
Start here:
https://pve.proxmox.com/wiki/Upgrade_from_4.x_to_5.0
Once you get to 5 the upgrade to 6 is similar but there is a new command pve5to6 you can run first to give you a test if things will work.
As...