Try indenting your code a bit it will help you see it. You have a do with no loop, an endif with no if and a for I loop with no next I.
[edit] I'm guessing something like this but I don't have the image to test and the code is uncommented.
REM BULLET TEST
load bitmap "images/tank_sprite.bmp",1
x=320
y=240
shellimage=9
shellfiredbyp1=0
dim p1shellslive(8)
REM =0,0,0,0,0,0,0,0
For I = 1 to 8
p1shells=0
Next I
Dim trajp1shells(8)
Dim shellimagep1x(8)
Dim shellimagep1y(8)
For I = 1 to 8
shellimagep1y(I)=-10
shellimagep1x(I)=-10
Next I
get image 1,0,0,50,50
get image 2,50,0,100,50
get image 3,100,0,150,50
get image 4,150,0,200,50
get image 5,200,0,250,50
get image 6,250,0,300,50
get image 7,300,0,350,50
get image 8,350,0,400,50
delete bitmap 1
p1currentimage=1
load bitmap "images/bullet.bmp",2
get image 9,0,0,4,4
delete bitmap 2
sprite 9,x,y,p1currentimage
stretch sprite 9,50,50
do
if scancode()=2
shellsfiredbyp1=shellsfiredbyp1+1
if shellsfiredbyp1=9
shellsfiredbyp1=0
endif
if p1currentimage=4
shellimagep1x(shellsfiredbyp1)=x+25
shellimagep1y(shellsfiredbyp1)=y
trajp1shells(shellsfiredbyp1)=4
endif
if p1currentimage=1
shellimagep1x(shellsfiredbyp1)=x
shellimagep1y(shellsfiredbyp1)=y+25
trajp1shells(shellsfiredbyp1)=1
endif
if p1currentimage=2
shellimagep1x(shellsfiredbyp1)=x+50
shellimagep1Y(shellsfiredbyp1)=y+25
trajp1shells(shellsfiredbyp1)=2
endif
if p1currentimage=3
shellimagep1x(shellsfiredbyp1)=x+25
shellimagep1Y(shellsfiredbyp1)=y+50
trajp1shells(shellsfiredbyp1)=3
endif
if p1currentimage=5
shellimagep1x(shellsfiredbyp1)=x+50
shellimagep1Y(shellsfiredbyp1)=y
trajp1shells(shellsfiredbyp1)=5
endif
if p1currentimage=6
shellimagep1x(shellsfiredbyp1)=x+50
shellimagep1Y(shellsfiredbyp1)=y+50
trajp1shells(shellsfiredbyp1)=6
endif
if p1currentimage=7
shellimagep1x(shellsfiredbyp1)=x
shellimagep1Y(shellsfiredbyp1)=y+50
trajp1shells(shellsfiredbyp1)=7
endif
if p1currentimage=8
shellimagep1x(shellsfiredbyp1)=x
shellimagep1Y(shellsfiredbyp1)=y
trajp1shells(shellsfiredbyp1)=7
endif
endif
FOR I = 1 to 8
If trajp1shells(I)=4
shellimagep1y(I)=shellimagep1y(I)-10
Endif
If trajp1shells(I)=1
shellimagep1x(I)=shellimagep1x(I)-10
Endif
If trajp1shells(I)=2
shellimagep1x(I)=shellimagep1x(I)+10
Endif
If trajp1shells(I)=3
shellimagep1y(I)=shellimagep1y(I)+10
Endif
If trajp1shells(I)=5
shellimagep1x(I)=shellimagep1x(I)+10
shellimagep1y(I)=shellimagep1y(I)-10
Endif
If trajp1shells(I)=6
shellimagep1x(I)=shellimagep1x(I)+10
shellimagep1y(I)=shellimagep1Y(I)+10
Endif
if trajp1shells(I)=7
shellimagep1x(I)=shellimagep1x(I)-10
shellimagep1y(I)=shellimagep1x(I)+10
endif
if trajp1shells(I)=8
shellimagep1x(I)=shellimagep1x(I)-10
shellimagep1y(I)=shellimagep1y(I)-10
endif
next I
sync
loop