To be able to use the results of your function in an expression (such as concatenating it with other strings in the example above), you need to return the value, not echo it.