Draw rectangles with the mouse, background refresh

ok … I’m not sure I understand … An error message appears “img can not be resolved to be a variable” … I admit to being lost and not knowing how to do it clearly