You need to be very clear/explicit in what you require. Try to think through the variations/conditions.
A simple built-in feature is: Select > All layers
Which will select all of the layers in your image example, except the Background image layer. Adding the Background layer to the selection is easy and can be accomplished via an action.
Or do you want:
* Only "normal" artLayers with a linked layer mask, regardless of layer name?
* Only artLayers with a layer mask, whether linked or not, regardless of layer name?
* Only artLayers with a layer name of "Layer #" where # could be one or may digits with or without mask conditions as above?
* Will the layers possibly be inside of a layer/group or set?
* Does the current selected layer name/position in the stack have any bearing on the result?
When you state like "layer 1,layer2,laye3 etc " do you mean normals layer with link layer mask. or mean layers with layer in the layer's name? "In this script"? You posted no script code? "create select layer at a time"? Can you elaborate on that?