There are many ways to do this. You could use something like this.
`put this outside your loop
sync on : sync rate 60
autocam off
set display mode 1024,768,32
backdrop on: color backdrop rgb(255,255,255)
`added for saving
disable escapekey
`load settings
if file exist("saved.dat") = 1
open to read 1, "saved.dat"
`get number of objects saved
read long 1, boxnum
`make place to store saved positions
dim box_pos_x#(boxnum)
dim box_pos_y#(boxnum)
`the first object was our placement object so it is not saved
`start with 2
for i = 2 to boxnum
`read positions
read float 1, box_pos_x#(i)
read float 1, box_pos_y#(i)
`make and place saved objects
make object box i, 1, 1, 1
position object i, box_pos_x#(i), box_pos_y#(i), 1
next i
`close when done
close file 1
`else make default settings if none are saved
else
boxnum = 1
`store positions of objects
dim box_pos_x#(1)
dim box_pos_y#(1)
endif
`make placement box
make object box 1,1,1,1
boxxpos# = newxvalue(1,1,1)
boxzpos# = newzvalue(1,1,1)
do
`move placement box
if upkey() = 1 and boxzpos#=<7 then boxzpos#=boxzpos#+0.05
if downkey() = 1 and boxzpos#=>-5 then boxzpos#=boxzpos#-0.05
if leftkey() = 1 and boxxpos#=<9 then boxxpos#=boxxpos#+0.05
if rightkey() = 1 and boxxpos#=>-7 then boxxpos#=boxxpos#-0.05
`modified slightly as it was checking for this input 3 times and it was
`creating a new box each loop instead of each time the key was pressed
`make new box and save positions
if keystate(28) = 1
`added this check to only make 1 box per button press
if rkp = 0
rkp = 1
boxnum = boxnum+1
make object box boxnum, 1, 1, 1
position object boxnum, boxxpos#, boxzpos#, 1
`add index to the position storing arrays to save for new box
ARRAY INSERT AT BOTTOM box_pos_x#(0)
ARRAY INSERT AT BOTTOM box_pos_y#(0)
`store positions
box_pos_x#(boxnum) = boxxpos#
box_pos_y#(boxnum) = boxzpos#
endif
`reset check when button is released
else
rkp = 0
endif
position object 1, boxxpos#, boxzpos#, 1
position camera 1, 1, 12
point camera 1, 1, 2
`if escapekey is pressed exit and save changes
if escapekey() = 1 then exit
sync
loop
`save settings on exit
if file exist("saved.dat") = 1 then delete file "saved.dat"
open to write 1, "saved.dat"
`save number of boxes created
write long 1, boxnum
`save positions
for i = 2 to boxnum
write float 1, box_pos_x#(i)
write float 1, box_pos_y#(i)
next i
`close when done
close file 1
`end program
end