One of the things you need to learn is spaceing. When you make a for next loop and if statements you need to space it in such a way that you can see at a glance where the for next loop begins and ends and where any if statements begin and end. In this case it's easy but the bigger the nest the harder it is to see without spaces. A lot of people use tabs but to me just one space per nested loop is fine. No matter how many spaces you use always make sure the begining of a loop and the end line up.
Here I forced the screen mode (you never know what people use so always force it on them). Syncing is a way to make sure the screen updates when you want it to... and not at every screen change (the default). "sync rate 0" means the computer will sync the display as fast as the computer running it can handle. "sync on" turns on the ability to "sync" when you want. In your code I put sync at the bottom so when it's done putting all the sprites on the screen you'll see them pop up at once.
I changed the "x=x+32" and "y=y+32" with "inc x,32" and "inc y,32" which do the same. If you just wanted to add one then all you need is "inc x". The opposite is "dec x". I also moved the "inc y,32" under the else statement so that it works properly (so that if y=0 inside the if statement it won't add another 32 when it leaves the if statement).
Hope this helps:
set display mode 640,480,32
sync rate 0
sync on
load image "johnny.bmp",1
x = 0
y = 0
for t = 1 to 319
sprite t,x,y,1
if y = 480
inc x,32
y = 0
else
inc y,32
endif
next t
sync
suspend for key
As for writing/reading files start by looking at the Darkbasic help files. (F1, click on Commands, then click on File Commands) They'll tell you the proper syntax for writing files. If you get stuck post.