How do I connect my Mid-2010 iMac to my Late 2015 Macbook Pro I mistook the mini Display Port (mDP) behind my iMac to mean it was a Thunderbolt port. The ⌘ Command F2 does not work when both ends are Thunderbolt for my setup.

Please suggest what cables to buy. 

Edit: This is 27 inch iMac
 Model Identifier: iMac11,3
If you are using a 27 inch iMac (Mid 2010) then you need a mini DisplayPort to mini DisplayPort cable.

According to Apple's Support Page, Use your iMac as a display with Target Display Mode, you can accomplish this with the cable referenced above, but only with a 27" iMac if you are using the Mid 2010 model.