The Messages app on the desktop should sync with the Messages app on iOS devices if the account details match.
So to Sync them both you need to make sure both your desktop and iOS device is sharing the same AppleID.
Aside from that the “you can be reached” identities should also be checked. iMessage can use a telephone number as the messaging identity.
After you make sure all that is set correctly the Messages App on the desktop should sync with the Messages app on your IOS device.