Terraria like map generating

Im trying to get a map generator to work, but so far no luck. Does anyone know why my code is not working?

public void GenerateChunk1()
{
GameObject grassy = (GameObject)Resources.Load(“grass”);
GameObject stony = (GameObject)Resources.Load(“stone”);
int rawr = 1;
System.Random rand = new System.Random();
Vector3 pos1 = new Vector3(0, 0, 0);
Height = 5;
Length = 4;
for (int z = 0; z < 10; z += 4)
{
Length = 4 + z;
//Build Chunk 1
#region Chunk1
for (int H = 15 - rand.Next(4); H < Height; H++)
{
for (int W = 0 + z; W < Length; W++)
{

                                pos1 = new Vector3(W * 18 + 15, H * 18 + 15, 0);
    
                               // Rectangle rect = new Rectangle(W * 18, H * 18, 18, 18);
                                
                                    if (rawr > Length)
                                    {
                                        Instantiate(grassy, pos1, Quaternion.identity);
                                    }
                                    else
                                    {
                                       // int y = (Convert.ToInt16(pos1.Y) + Convert.ToInt16(rand.Next(3)));
                                      //  int x = (Convert.ToInt16(pos1.X));
                                     //   Vector2 pos3 = new Vector2(x, y);
                                       Instantiate(grassy, pos1, Quaternion.identity);
    
                                        rawr++;
                                    }
    
                                
                            
                            }
                        
                    #endregion
                    }
                }
            }

Trying to get a map generator, terraria esque type generator.