Connecting a Wave and String

Hello! I am currently struggling to connect strings and waves (if that is possible). What I basically want to do, is when I use a listbox and check waves I want as an output, that it will create a new wave with what I checked. For example, I check waves A and B and when I hit a button to create the output wave, only A and B would show up in that output wave. I am trying to make a string right now in order to connect my waves like A and B to put into my output.

Heres what I have so far:

variable a=1
    string data_wave = "wave"+num2str(a)
   
    variable i
    for (i=0;i<4;i+=1)
   
        wave checkwave 
        if (checkwave(i)==48)
            make /T out_wave
           
            redimension /N=(numpnts(out_wave)+1) out_wave
            out_wave[numpnts(out_wave)-1]= data_wave
        endif
    endfor

With this, I get an error in the num2str(a). This was also just a guess for what I want my code to do. I would usually stick to using prompt, doprompt, and popup menus for this, but I want to be able to put multiple waves into my output wave.

Any help would be greatly appreciated, please let me know if anything I said didn't make sense. Thanks!

Let us see the whole experiment; it's pretty hard to figure out what you intend from this snippet and description.