To make things work we need to use the method replaceText() to replace a text in the document body then using the reverse() method to reverse the text.
Sample Script:
function myFunction() {
  const docs = DocumentApp.getActiveDocument();
  const body = docs.getBody();
  // store your variable names with value here
  const [varOne, varTwo, varThree] = ["foo", "bar", "sample"]
  // reverse the string by converting the it into array by using split and convert it back to string by using join method
  const reverseText = (string) => {return string.split("").reverse().join("")}
  // using replaceText to replace a text in the body
  body.replaceText("{variableOne}", reverseText(varOne));
  body.replaceText("{variableTwo}", reverseText(varTwo));
  body.replaceText("{variableThree}", reverseText(varThree));
}
Output:
Note: Image is for visibility only.
Reference: