Magic Dosbox has a backup feature, see here:
This will create a complete backup of all your game profiles and settings.
Copy this file to your pc, or even better, upload it into your Google Drive account (share feature somehow doesn’t work for me, else it would be possible from the file dialogue at the end).
Anyway. Once you’ve reset your phone, reinstall Magic Dosbox, copy/download the backup to your phone, and unzip the backup file to your sd card. If you’re using the “public” install location (recommended), an invisible folder labelled “.MagicBox” will be extracted to /sdcard/.MagicBox
You can check if it’s there with any 3rd party file explorer that supports display of invisible files (e.g. Solid Explorer or ES File Explorer).
Mind that you will have to backup the DOS games themselves manually. Magic Dosbox will backup your profiles, but not the attached games (else the backup file would become HUGE ?).