Your code(s) are garbage. Just use the code in post #3 and you are done. Yours is completely off-base to post #1.
As for the OP ....
Seriously Amitrandive, what you not understand in post #3. Do you know what Varset and Varget mean?
You just have to
fill in. What is the problem in doing so? It's like filling in colors in a 99% finished painting. An elementary school kid can do that.
So let's start with first loop:
You want to set variables MH1 to MH12 and variables ML1 to ML12. So what should be the names in the two VarSet lines first parameter of first loop and what variables has to be inserted in second parameter of Varset since you look for HHV and LLV? It's so easy.
From the AB manual
Use trace if you do not understand what is happening in the AB manual loop
Code:
for( i = 1; i < 10; i++ )
{
VarSet( "C"+i, Ref( C, -i ) );
_Trace( StrFormat( "VarGet call -> C%g = %1.2f -> stores Ref( C, -%g)", i, VarGet( "C" + i ), i ) );
}
Now adapt to post #3 first loop.. you want variables MH1 to MH12 and ML1 to ML12 which shall store HHVs and LLVs.
Finally step out of copy&pasting and think a little bit and learn how to fish.