I'm a resident in a teaching hospital and not a staff member in a university, how to write my name and my job description in a publication as an author
Write your affiliation similar to how you'll do it with a university.
[Designation,] Dept., Institution
If your hospital does not split members into departments, then Dept. part can be omitted.
Neurosurgeon, XYZ Clinic
Researcher, Cancer Research Lab, BCD Hospital
Cryogenics, GHI Health Institute
Note that it is not always necessary to include your designation (job description), unless the publisher asks for it.