How to translate these commands into AppleScript I'm very not tech savvy and I just heard about AppleScript that can automate some simple typing for me. I just want to continuously type in a loop. Could someone please help me translate the instructions below into an AppleScript loop? I appreciate it so much!

click the right arrow key
delay 2 seconds
type "l"
delay 2 seconds
type "c"
delay 2 seconds
type "cool!"
delay 2 seconds
hit return
delay 2 seconds
hit escape
delay 2 seconds
repeat this whole thing


Can anybody help me with that?
Further background information: I'm already in the program so I don't need this to open it up for me. I just need the script to immediately go to the right and then start typing.

Please help! So many thanks!
First of all, be careful with this kind of thing. System automation utilizing something like a virtual keyboard like this can lead to unfortunate side-effects if you end up sending key strokes to an unintended target.

However, here:

repeat
    tell application "TextEdit"
        activate
        tell application "System Events" to key code 124
        delay 2
        tell application "System Events" to keystroke "l"
        delay 2
        tell application "System Events" to keystroke "c"
        delay 2
        tell application "System Events" to keystroke "cool!"
        delay 2
        tell application "System Events" to keystroke return
        delay 2
        tell application "System Events" to key code 53
        delay 2
    end tell
end repeat


Let's go through this code:

First, we are doing a simple repeat without end. This is not a good idea, but you asked for it and that's what you get. If you wanted just a finite number of times, you could add # times after repeat. Ex: repeat 3 times. There are many other methodologies to repeat beyond this answer.

Then you are going to create a tell block and activate the application you are sending these commands to. If you do not do this, you will be sending keystrokes willy nilly to whatever happens to be the active application at the time.

You will then do a series of having the "System Events" application emulate a keystroke and delaying for a count. delay accepts decimals as well as integers for number of seconds. Note that for the Right Arrow and Escape I used key code 124 and key code 53 respectively. The list of key codes can be found in various locations online with a Google search for 'applescript key codes'. Here is a current one at the time this answer was written: http://eastmanreference.com/complete-list-of-applescript-key-codes/

Finally, you will end the tell block, no longer sending AppleScript to "TextEdit" and then you will end your repeat block.