xml is not a programming language. It just describes your frames.
You dont need xml for an addon.
Addons register for events that should trigger functions. Or you can trigger a timed event.
Take a look at
SetScript and
RegisterEvent.
Edit: Keep in mind that functions should be local, too.