All looks good provided that your actual files are indented correctly
Otherwise each command will just execute sequentially
if job.file.fileName == null
M99
if {{global.filamentProgress + 11500.0} <= move.extruders[0].position} ;
set global.filamentProgress = {move.extruders[0].position + 11500.0}
M106 P0 S255
G4 S3
M106 P0 S0