If you notice the indentation of the code, you'll see that you have a bracket mismatch somewhere, so mirc thinks the :TO and :FROM labels are outside the on sockread event. Use the {} button in Editor to check for mismatches.
On a sidenote, at least half of your goto commands are redundant and only make your code harder to read and maintain. You should generally avoid using goto and keep in mind that a script is executed line by line, so there is no point in having something like:
:START
if (220 isin %temptext) { sockwrite -n $sockname helo $host | goto FROM }
:FROM
mirc will go to FROM either way, that is whether the if condition succeeds or fails, simply because :FROM is the next line.
Also, instead of having something like this:
if (something) {
<commands>
goto LABEL
}
else {
goto LABEL
}
you can have something like this:
if (something) {
<commands>
}
goto LABEL
The above 2 are equivalent.