Formatting in fortran is a pain. Use the '$' in a format statement to omit the carriage return that follows a write statement. E.g.,
do 100 i=1,10
if (i.eq.1) then
write (*,110) i
else if (i.lt.10) then
write (*,120) i
else
write (*,130) i
endif
100 continue
110 format($,I1)
120 format($,1X,I1)
130 format($,1X,I2,/)
is one way to output
1 2 3 4 5 6 7 8 9 10