how to pass item info out of handler input as list

I am trying to search and replace an item in the text and then take the new text out of the handler.
I tried to use set finaltext to item 1 of the handler and got this message

How can I get finaltext out of the handler?

to searchReplace(thisText, searchTerm, replacement)
	set AppleScript's text item delimiters to searchTerm
	set thisText to thisText's text items
	set AppleScript's text item delimiters to replacement
	set thisText to "" & thisText
	set AppleScript's text item delimiters to {""}
end searchReplace
set finaltext to item 1 of searchReplace(,,)
to searchReplace(thisText, searchTerm, replacement)
	set AppleScript's text item delimiters to searchTerm
	set thisText to thisText's text items
	set AppleScript's text item delimiters to replacement
	set thisText to "" & thisText
	set AppleScript's text item delimiters to {""}
	return thisText
end searchReplace
set finaltext to item 1 of searchReplace(A, B, C)

You have to return the result - the altered form of thisText which exists only in the handler; it’s not global.

When I omit the last line of the code in my result pane I see the full text (which is quite long with a lot of spaces to start out) .
When I put the last line in I get quotes surrounding blank text in the result pane. How can I check finaltext to determine the proper text has been passed. I have been using the return command but you can only use it once right?

searchReplace(stringTxt, "Next", "Listen!")
to searchReplace(thisText, searchTerm, replacement)
	set AppleScript's text item delimiters to searchTerm
	set thisText to thisText's text items
	set AppleScript's text item delimiters to replacement
	set thisText to "" & thisText
	set AppleScript's text item delimiters to {""}
	return thisText
end searchReplace
set finaltext to item 1 of searchReplace(stringTxt, "Next", "Listen!")

You haven’t explained what “item 1” might be. You’ve returned a string, not a list. I don’t have enough info. If you remove the item 1 from your last line, you’ll get the same result as the handler returns.

yes, this is what I was looking for. I missunderstood the error messages and thought I had to specify which term of the handler I wanted such as in a list.