What you are doing there has a null effect, you're making changes and then undoing them.

And no, looping is not the only way, if you read the post I linked you to, you see that the code for the $text alias has no looping, so why do you ask? Of course, internally there is looping in that code, but I'm sure you were referring to using a scripted loop.

$rawmsg contains more than just the string that has been said, it also contains who said it and where (it's raw data from the irc server, hence the name $rawmsg) so can't just do the replace, you need to do it so you only echo the relevant string. An example of what $rawmsg could look like:

:FOPtics!FiberOPtic@cable-213-132-147-76.upc.chello.be PRIVMSG #cellka :hello

Please, we like helping out, but you have to atleast do the effort to actually read the help that you've been given. Anyone that had thoroughly read qwerty's post that I linked you to, would have never asked the questions you did.