CodSec interview question

Why did you write the script that way? The logic behind it