Once inside TWRP (touch screen works):
This post explains installing Android 7.1.2 (Nougat) on the Samsung Galaxy Tab 2 10.1 GT‑P5100. The tablet shipped with Android 4.x and is not officially supported beyond that — installing 7.1.2 requires an unofficial custom ROM and steps below. Proceed only if you understand the risks: voided warranty, potential bricking, and data loss. Back up everything first. Download Samsung Tab 2 10.1 Gt-p5100 Android 7.1.2
To get the Play Store, Gmail, and Google Services, download Open GApps. Once inside TWRP (touch screen works): This post
You are now inside TWRP Recovery. Do not skip wiping – old Jelly Bean files will crash Nougat. and Google Services