Can not install CUDA on my Kali Linux Machine for GT 740m

I want to install the required drivers for this graphic card on the Kali Linux. I followed the steps here in this link:

But after doing so nvidia-smi command does not work and gives me below error:
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
I also tried to install legacy drivers 390.xx but again when I try to install CUDA it throws kernel version mismatch error.
Can you please tell me what am I supposed to do step by step?

Your Kepler based GT740M is now deprecated and is supported by driver v470 and cuda 11.4 max. I’d recommend that you start by cleaning the nvidia packages first, the install the 470 legacy driver from debian repo. Afterwards, download the cuda 11.4 runfile installer and use that to install cuda, skipping driver install when it asks.