How can I script a macro to my Mage do several sequencial attacks? I've tried the command /castsequence but it doesn't works.
WoW's macro system is deliberately unable to cast multiple spells with a single keypress except in very specific circumstances; this is to discourage botting/cheating. Blizzard's approach to macros (in-game or out) is that one keypress should trigger only one action.
The only case in which multiple spells/items can be used in a single macro is when only the last one triggers the global cooldown. This means that a warlock could macro Soulburn and Summon Felhunter together (because Soulburn doesn't trigger the GCD), but not Bane of Agony and Corruption. If you have many spells or items which don't trigger the GCD, you can even chain them together, as in the (in)famous PoM/Pyro macro for mages.
If you want to cast multiple GCD-causing spells with the same macro, you can use
/castsequence to do it, but you'll need to hit the macro once for each spell. This can still provide plenty of flexibility even for fairly complex cast sequences, especially when combined with other macro commands and conditionals. I thoroughly recommend Wowpedia's page on Making a macro for learning how to create powerful macros.