That can easily be achieve with lodash template https://lodash.com/docs/4.17.15#template
import _ from "lodash";
import wixWindow from "wix-window";
$w.onReady(() => {
//select the text depending on the formFactor
let instructions = wixWindow.formFactor === "Desktop" ? "click" : "tap"
//create the template based on the initial text
//instruction initial text is "For more info ${instruction} here"
var compiled = _.template($w("#mapInsctructionsText").text);
//Compile the template with the variable value 'instructions'
$w("#mapInsctructionsText").label = compiled({instructions});
}