There is a fundamental difference between outputting data using Write-Host and just "leaving info behind":"
Write-Host "Result A"
When you run the function, you will get back both results, but Write-Host always directly writes to the console. As such, So you cannot store this result in a variable to process it later.
$a = test