OK, now I get it. You have a MBP with a QWERTY keyboard, kind of a "standard" English language keyboard. But you have a USB keyboard with a different layout with "QWERTZ" on the top row. And when you use that USB keyboard on the iMac, you still get the QWERTY results.
The cause of the mapping is that the languages chosen on the MBA and iMac are different, which sets the keyboards. You can choose the keyboard layout at System Preferences/Language & Region, select the language you want by clicking on the "+" button below the "Preferred Language" window and scrolling to find the language you want. Then after you select the language, click on Keyboard Preferences and the options for the languages you have available should appear, where you can select the one you want to match the Magic keyboard.
Reinstalling macOS won't fix it, if you just overlaid the original installation. If you did a whole factory installation, then when it boots and goes through the initialization stage where you select your region and language, you can make the selection there. If you did an overwrite, you may not get the original setup, so you will have to use the process I gave once it is booted.
As for the mouse, all I can suggest is to start here:
Use an Apple wireless keyboard, mouse or trackpad with Mac and follow the directions. Note that the process in that document does not use the System Preferences/Bluetooth menu but the System Preferences/Mouse menu.