This bit:

Code:
on 1:connect: if ($me == mainnick) { msg nickserv identify %username %password | echo -a your nickname matches with your main nickname and you are now identified on this network }
else { msg mainnick could you please change your nick that is my usual nickname. }


Will not work because you haven't used { } with the on connect event. This means that your else { } clause isn't attached to any event or alias, so it will never be reached by the script.