That article has confused a lot of people. The short version:
I have a 2020 M1 chip MacBook Pro...
👉🏻 No Apple Silicon Macs nor any Mac dated as a 2020 model can use Target Display Mode to send a video signal to any iMac set up as an external monitor.
... and want to use a 2009 iMac 21.5" screen as an external monitor
👉🏻 TDM support for 21.5-inch iMac was limited to Mid 2011 through Mid 2014 models. No workabouts there.
You still have the option of macOS screen sharing:
Share the screen of another Mac - Apple Support
or several similar third-party software methods.
Apple have done the full Rasputin on TDM; shot; stabbed; drowned; poisoned, etc.