I want it to extend the display not mirror it.
No can do. Target Display Mode (TDM)—now very dead technology— NEVER supported extended desktop, only mirroring. That was one of its major weaknesses. Downgrading your iMac's OS will not fix this.
Most users understand that only a few iMacs running High Sierra or older could act as a monitor for another Mac. What seems to get overlooked are the hardware and software sysreqs for the Mac SENDING a video signal to a TDM-supported iMac. The sending Mac but be Intel, 2019 or older, and running macOS 10.15 Catalina or older. Big Sur, Monterey are not supported: Apple Silicon (M-series) Macs are not supported.
The only way to get reliable performance and an extended display is with a regular external monitor. For te money you could spend on expensive cabling and adapters to get some Macs to work with TDM, you could buy a very nice external monitor that has no issues doing extended desktop
Sysreqs are here: Use your iMac as a display with target display mode - Apple Support
To the best of my knowledge, the oft-mentioned software workarounds do not do extended desktop either.