Show the array values as a radio button

I want to pass my array as an input to the radio button field. I have an array of values, when I click a button, it should show me all the values in the array as a radio button.

I tried this, but not able to get any values , only radio button gets created. Can someone help me with this.

/Javascript code/

var curr=0 ;
function addradio(){
   const names =["abi","sam","tom"];
    document.getElementById("my_div").innerHTML=document.getElementById("my_div").innerHTML+
"<br><input type='radio' id='my"+curr+"' name='names[]'"+  
"<input type='radio' id='my"+curr+"' name='names[]'";
  curr=curr+1;
}