We can't help you unless you tell us exactly how you want your script to be.

Tell us what hotkey you want to trigger the loop and the exact sequence. We don't know how to start or stop chat. Some games for example, need you to click a specific location or press a specific button to chat, what is it in your game? There must be one or you would end up typing 1 right.