The error message is telling you what is wrong.
fputcsv() expects parameter 2 to be array
And from your own admission (emphasis mine)
If I var_dump($line) I get string(2) "37" each string and its the correct value
Why not try this? You're building an array already.
foreach( $catresults as $catresult ) {
$newCsvData[] = $catresult->term_id;
}
fputcsv($handle, $newCsvData);