Issue with Resuming Print via Custom G-code – AMS Filament Not Feeding

Switching to this version of the code (found on the forum) BBL P1S organized start and end gcoderesolved the issue with filament not extruding properly after restart. Thanks to everyone who helped!

; ===== Filament loading and heating (based on AMS logic) =====
M620 M                    ; Refresh AMS status
M620 S0A                  ; Select AMS slot 0 for tool T0
M109 S220                 ; Set and wait for initial layer nozzle temperature

G1 X120 F12000            ; Move to start of the purge path
G1 X20 Y50 F12000         ; Enter purge zone
G1 Y-3                    ; Drop filament blob outside the bed
T0                        ; Select tool 0
G1 X54 F12000             ; Move to start of wipe line
G1 Y265                   ; Move along wipe line
M400                      ; Wait for all movements to finish
M621 S0A                  ; Load filament from AMS slot 0

; Filament flushing at calculated speed and temperature
M620.1 E F299 T240        ; Purge with specified flow rate and temperature

; ===== Physical nozzle cleaning and shake to drop residue =====
G1 Z50 F3000              ; Lift head for safe purge
G1 X60 Y265 F5000         ; Move to purge zone
G92 E0                    ; Reset extruder position
M83                       ; Enable relative extrusion
G1 E50 F200               ; Purge 50mm of filament

; Shake the nozzle to remove residue
G1 X60 F15000
G1 X80 F15000
G1 X60 F15000
G1 X80 F15000
G1 X60 F15000
M400                      ; Wait for movements to finish

; ===== Transition to working temperature =====
M104 S220                 ; Set working temperature
M109 S220                 ; Wait until temperature stabilizes
G92 E0
G1 E5 F300                ; Prime the nozzle
G1 E-0.5 F300             ; Slight retraction before printing

In the photo, the red part is the resumed print, and the white part is the first 14 layers after which the print was interrupted. I’ve had the printer for 5 days, and this feels like a small victory for me in solving the issue. Thanks to everyone!