Short Answer:
You can't, any longer.
Sorry, but I was never able to find a reliable answer to this.
My dad had very poor hearing, and progressively worsening issues with cognition and memory before he passed.
He'd come to rely on call recorder to reference conversations, but the feature was actively blocked several years/android versions-back.
I cannot recall the last version of Android that didn't actively block this capability. -last time I saw any call recorder app work at all, was on an old LG Stylo 2.
Even, on GrapheneOS, the OS (by default) actively tries to prevent call recording, and I wasn't willing to 'break it' further.
Personally, I'd be looking into an external device to accomplish this. If there's a 3.5mm TRRS jack on the phone, it should be easy.
At least back in the landline days, devices to do such were not uncommon. Though (as today) looked at as 'potentially for illicit use'.
Unless law has changed, the devices (and software) themselves were never illegal (in most of the US).