Hi Abigail,
I'm having to make a few assumptions here, but if those assumptions are true, then yes, it is definitely possible to do what you want.
I'm reading your question that you have a broken phone with an intact and functional motherboard and would like to purchase a brand new phone of the exact same model, then swap out your motherboard for the one in the new phone, thus fixing everything that was wrong with your old phone and allowing you to access all the data that was on the original phone.
If that's the case, then indeed, it should work perfectly. All you need is to follow the motherboard replacement guide twice; once to remove the motherboard from the original phone, then again to take out the motherboard of the new phone. Reassemble the new phone with the old motherboard and you should be all set. Read through this guide, and if you think you can follow the instructions then go for it!
[guide|154345|Motorola Moto G Stylus 5G (2022) Motherboard Replacement - iFixit Repair Guide]
If you need any tools, you can buy them right here on iFixit; the guide tells you everything you need. The only other thing you might have to have is a sheet of precut adhesive to glue the rear cover back on the phone once you're done, which you can also buy here on iFixit.
[product|IF390-078|ifixit.com/products/motorola-moto-g-stylus-5g-2022-battery-cover-adhesive]
If you have any questions, feel free to ask, otherwise good luck with your repair! Once you're done, come on back and let us know how it went; success stories are always appreciated, and we can usually learn something when things don't go as planned.