Your problem is in your for/next loops. You keep creating the same object 200 times. Every object must have a separate object number.
for i=1 to 200
make object sphere 2,0.2
color object 2,rgb(255,0,0)
position object 2,rnd(200),get ground height(1,i,i),rnd(200)
next i
for i=1 to 200
make object sphere 3,0.2
color object 3,rgb(0,0,255)
position object 3,rnd(200),get ground height(1,i,i),rnd(200)
next i
for i=1 to 200
make object sphere 4,0.2
color object 4,rgb(0,255,0)
position object 4,rnd(200),get ground height(1,i,i),rnd(200)
next i
Instead, your loop should go like this:
for i=2 to 201 :`You already used object number 1
make object sphere i,0.2
color object i,rgb(255,0,0)
position object i,rnd(200),get ground height(1,i,i),rnd(200)
next i
So instead of creating object number 2 200 times, change your loop to go from 2 to 200 (we are starting with object number 2 because you already used up object number 1) and create an object number with each of those numbers. Like this:
for i=2 to 200
make object sphere i,0.2
color object i,rgb(255,0,0)
position object i,rnd(200),get ground height(1,i,i),rnd(200)
next i
Now to make your next set of 200 spheres, we will need to do a loop that starts at 201 and goes to 400:
for i=201 to 400
make object sphere i,0.2
color object i,rgb(0,0,255)
position object i,rnd(200),get ground height(1,i,i),rnd(200)
next i
And now for your next 200 spheres, we will start with object number 401 and go to 600...
for i=401 to 600
make object sphere i,0.2
color object i,rgb(0,255,0)
position object i,rnd(200),get ground height(1,i,i),rnd(200)
next i
That should work for getting your objects properly created.