Bash can do string replacement by itself:
template="my*appserver"
server="live"
template="${template/\*/$server}"
See the advanced bash scripting guide for more details on string replacement.
So for a bash function:
function string_replace {
echo "${1/\*/$2}"
}
And to use:
template=$(string_replace "$template" "$server")