How to apply list of materials in one layer of wall?

Hello All,
I have created my wall layers. I want to change material for one layer automatically. I got stocked in these nodes.
That would be great to have your helps. Thank you so much.1

I have updated my nodes. Could you please help me to figure out my mistakes?
Is this approach correct?
Why this error?

Hi Raha,

Your approach is closer but you need to modify your graph little as shown below.Good Luck!