Applescript - save results to variable

You probably just need to uncheck the "Trim Results" option in the Action Gear menu: