You need TWRP 3.0 or higher to flash Nougat.
You cannot download an official Android 7.1.2 firmware for this tablet because Samsung never released one. The tablet stopped at Android 4.2.2. When you search for "Android 7.1.2 firmware" for this device, you are looking for a Custom ROM . download samsung tab 2 10.1 gt-p5100 android 7.1.2 firmware
Here is the story of how I brought that tablet back to life, and a guide on how you can do the same. You need TWRP 3