Target display mode is a feature that was available only with certain older iMac models.
The feature has been deprecated by Apple and is no longer supported in hardware or software.
Please see: Use your iMac as a display with target display mode - Apple Support
Having said that, per the link above, only the following older iMac models could be used as an external display for another older Mac model:
- iMac models introduced in 2011, 2012, 2013, and mid 2014 using Thunderbolt or Thunderbolt 2 cable.
- 24-inch and 27-inch iMac models introduced in 2009 and 2010 using Mini DisplayPort cable.
- The intended target iMac (your iMac 27" 2010) must be running macOS 10.13 High Sierra or earlier; it does not work with macOS 10.14 Mojave or later, or with Boot Camp and Windows.
- Retina display iMacs won’t work as target displays.
- In all cases the source Mac that you're connecting FROM (your 2010 MBP) must have macOS 10.15 Catalina or earlier installed.
I will suggest that if you can't make this work easily, consider that any number of decent monitors can be had today for $100 or less. That would typically include easy setup, no headache and no special ($$) cabling. And these monitors will use less electrical energy than your old iMac. 👍🏽