Yes I also noticed the missing Next...But it seemed to work fine for me even without it. I did add it below however...The following works fine on my machine. I added the get $ after the end of the loop so that you can see on the console if it does indeed find any matches or not. Other than that just verify that the paths for the $fila, b, and c are correct and you have the necessary rights to create the filec on the C:\.

Code:
cls 
$fileA = loadfile("c:\ssn.txt")
$fileb = loadfile("c:\data.txt")
$filec = Open(1,"c:\outdata.txt",5)


For Each $line In $fileb
$ssn = substr($line,1,9)
If AScan($filea,"$ssn")+1
? "A SSN In file b was found In file a, writting the line To file c"
$ = WriteLine(1,$line+@CRLF)
EndIf
Next

? "DONE - Press any key to exit"
get $

Function loadfile($file)
DIM $fso,$f,$fs
$fso = CreateObject("Scripting.FileSystemObject")
$f = $fso.GetFile($file)
If @ERROR Exit(2) EndIf
$fs = $f.OpenAsTextStream(1)
$loadfile = Split($fs.Read($f.size),@CRLF)
Exit(@ERROR)
EndFunction