Auto punch in at Cursor, play back last 2 seconds

I would like to record a voice over and record on top of my track with an automatic punch in at the cursor.
I would love to automatically play back the last N (2 in my case) seconds when I hit record again and then punch in where I clicked.

Note: Not automatic punch out. I need the punch out for later editing but during the principal recording I only need punch in.

How do I set this up. I got it to work in Reaper but since I own cubase and am more familiar with it I would rather work in Cubase. But I don’t know how to make this work.