You haven't met the system requirements as set forth in this Support article:
Use your iMac as a display with target display mode - Apple Support
The iMac to be used as the external monitor for another Mac must have NO NEWER macOS version that 10.13 High Sierra. You have 10.15 Catalina.
Also, Macs running macOS Big Sur and higher, and Mac models 2020 and newer, cannot be the video source for an iMac set as an external monitor.
Target Display Mode was always a limited feature and support for it was dropped from iMacs in late 2014. Apple finished off its deprecation in early 2020.
Do not believe the hype on the internet. Starving web journalists having neither research skills or editorial help tried to cash in on the work-from-home article rush after COVID. They've attributed to TDM everything from working with non-Apple products to the parting of the Red Sea.