How to change the internal logic of an IR sensor module?

Thank you @anon57585045. Its my first time submitting to this forum. I will henceforth put the code in the code tags and remove black lines. Ive tried the code and its giving the output i wanted.