Using netcat stty not giving complete tty shell when doing CTRL+Z

I’m using netcat and stty to get terminal (tty) access, but I’m not able to do so as the CTRL+Z action on the netcat session is giving me suspended session instead of stopped and then I’m not able to resume the suspended session.

enter image description here

However, what I expect the output to show as stopped as shown here

enter image description here

Also in the first pic you can see as I try to enter fg for the second time I get ^M plus its says continued sudo I’m not sure what wrong I’m doing as I’m just following the guide mentioned here.

https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/