You can nest for (and other) loops, as long as you use different letters for the iteration (i) at each level. Also, when digging this sort of vertical pattern out, it makes sense to dig, digUp, and digDown so that you mine three blocks per move. It saves a good bit of fuel and time, as well as slowing down the actually movement of the turtle so you can shut them off if they "go wrong" during a test.
What you were missing was an end on one of the for loops. This probably just happened because you were using cut/paste instead of for loops to repeat things. It is one reason that I like to put short for loops (and other such things) all on one line if they will fit, you can treat the entire loop as a single line. Also, I'm a bit funny that way. I believe that you also intended the "if y ="go" then…end" structure to encompass the entire excavation part, as you had it it encompassed nothing, making it irrelevant whether or not y was equal to "go" because nothing different happened if it was than if it wasn't.
Here I've tried to reconstruct your intent as far as I can discern it:
repeat x,y,z=rednet.receive()
print(y)
if y ="go" then
for i = 1,2, do turtle.digDown() turtledown() end
for i = 1,7 do
turtle.digDown()
for j = 1,16 do turtle.dig() turtle.forward() turtle.digDown() turtle.digUp() end
for j = 1,3 do turtle.digDown() turtle.down() end
turtle.turnRight()
turtle.turnRight()
end
for i = 1,16 do turtle.dig() turtle.forward() turtle.digDown() turtle.digUp()end
turtle.digDown()
for i = 1,26 do turtle.digUp() turtle.up() end
end
until y = "no"
This is a loop that gets rednet messages until one says "no", at which point the loop terminates. If one of the messages is "go", then it dig/moves down two, and begins a trench, 26 deep and 17 long, by moving back and forth 8 times, or four "forth"s and four "back"s. It then ascends back up to where it started.
This version is much smaller and easier to check.
I should note that it is not actually necessary in this case to use different iterator names for each level of the loop, for iterators have scope within the loop and so there is no confusion on the program's part even if you use the same identifier for every level. But eventually you're going to want to do something with those iterator values during the loop, and then it is very good to be able to get them by having different identifiers for them.