How to replace text in google docs using the cell address of google sheets?

I have a doc that contains text like %A1%, %B3%, %A3%, and so on. I have a Google sheet. I want to replace the text in the Google doc from the Google sheet. The replacement is to be made like this:”%A1% will be replaced by the value in cell (1,1), i.e., the value in range”A1:A1″,”%C3% will be replaced by the value in cell (3,3), i.e., the value in range”C3:C3″ and so on. The following code is just for one cell. I want to loop through all cells in the sheet and make all replacements. Any help will be appreciated.

function myFunction() {
  var myDoc = DocumentApp.openById('docID')
  var docBody = myDoc.getActiveSection()
  var sss = SpreadsheetApp.openById('sheetID); 
  var x =  sss.getRange("A3:A3").getValues()
  docBody.replaceText('%A3%', x)
}