There is no need to remember last position. "Start from selected line" knows what is position of previous line.

Here is a script that will go to sale height (setting for measure tool length is used) and then go to position.
Dialog will open where you can click cancel to abort or ok to continue with plunge down.

Code:
(print,OnStart script @ Line: #<line,0>)
(print,  PosState: X#<posstate_x,3>, Y#<posstate_y,3>, Z#<posstate_z,3>)
O<chk> if [#<line>]
  (print,  MistState: #<miststate,0>)
  (print,  FloodState: #<floodstate,0>)
  (print,  SpindleState: #<spindlestate,0>)
  (print,  MotorsState: #<motorsstate,0>)
  (print,  LimitsState: #<limitsstate,0>)


  G53 G00 Z#<_tooloff_safeheight>
  G53 G00 X#<posstate_x> Y#<posstate_y> 
  
  G09
  (dlgname,Start From Selected Line)
  (dlg,Clock OK to continue, typ=label, color=0xffa500)
  (dlgshow)
  
  G53 G00 Z#<posstate_z>
O<chk> endif