This is my solution based create nest list Points intersect of grids.
int chunkSizeY = GridX.Count;
// Chop the list into chunks
List<List<XYZ>> choppedListY = ChopList(pointY, chunkSizeY);
for (int i = 0; i < choppedListY.Count-1; i++)
{
for (int j = 0; j < choppedListY[0].Count-1; j++)
{
XYZ p1 = choppedListY[i][j];
XYZ p2 = choppedListY[i][j+1];
XYZ p3 = choppedListY[i+1][j+1];
XYZ p4 = choppedListY[i+1][j];
Line l1 = Line.CreateBound(p1, p2);
Line l2 = Line.CreateBound(p2, p3);
Line l3 = Line.CreateBound(p3, p4);
Line l4 = Line.CreateBound(p4, p1);
List<Curve> loopSegments = new List<Curve> { l1, l2, l3, l4 };
CurveLoop closedLoop = CurveLoop.Create(loopSegments);
Floor.Create(doc, new List<CurveLoop> { closedLoop }, floorTypeId, level1.Id);
}
}