adding an action inside if condition not working

adding an action inside if condition not working