what am i doing wrong here some help please

Not sure I understand what you are trying to achieve then - thought it was the whole loop

Please describe in detail the behavior you want to see - really in detail (what needs to work, what IR does . Where is the button etc)