Applescript : refer to an app from a variable
As already mentioned in a comment by red_menace, "The target for the tell statement is needed at compile time."; however, here is an alternative method:

Example AppleScript code:

set SafariBuild to "Safari Technology Preview"

if (SafariBuild's contents = "Safari") then
    tell application "Safari" to do JavaScript ¬
        "document.querySelectorAll(\"[class=\\\"icon-chevron-left\\\"]\")[0].click();" in tab 2 of window 1
else if (SafariBuild's contents = "Safari Technology Preview") then
    tell application "Safari" to do JavaScript ¬
        "document.querySelectorAll(\"[class=\\\"icon-chevron-left\\\"]\")[0].click();" in tab 2 of window 1
end if



Or you could use choose from list, as in this example AppleScript code:

choose from list {"Safari", "Safari Technology Preview"}
if result is not false then
    set SafariBuild to result as text
else
    return
end if

if (SafariBuild's contents = "Safari") then
    tell application "Safari" to do JavaScript ¬
        "document.querySelectorAll(\"[class=\\\"icon-chevron-left\\\"]\")[0].click();" in tab 2 of window 1
else if (SafariBuild's contents = "Safari Technology Preview") then
    tell application "Safari Technology Preview" to do JavaScript ¬
        "document.querySelectorAll(\"[class=\\\"icon-chevron-left\\\"]\")[0].click();" in tab 2 of window 1
end if






Note: The example AppleScript code is just that and does not contain any error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.