You can create a backup file of your entire library by tapping the ⚙️ icon in the top-right corner of the Library view > Settings > Backup Data.
Where is this backup saved?
When the backup process is done, the Share Sheet will show up and you can select a destination or any app to save the backup file (in .zip) to either iTunes, iCloud, a supported cloud storage through the Files app, an external app, and so on.
Please note that GoodNotes needs to stay open in the foreground to finish the backup process.
If you close the app, the backup process has to be restarted.
How to restore your backup
You can restore your backup file back to GoodNotes library simply by importing that .zip file.