How do I print a specific number of A based on a value from a cell in Google Sheets

There’s a cell that would contain the number of times a letter would be printed in a cell.


cell a1 = 3. b1 should look as “A A A”

my rough script is:

for(var arow=0; arow<4; arow++) {
  var numberofo = actsheet.getRange(arow+1,1).getValue();
     for(i=0; i<=numberofo;i++) {
         var test = actsheet.getRange(i+1,2).setValue("o");

Sorry the code looks rough. Haven’t coded for the last 7 years.