Store the position and the velocity of the ball. Then you must add this in your game loop:
LOCATE X,Y
? " "
IF collission(X,Y+DY) THEN DY=-DY
IF collission(X+DX,Y) THEN DX=-DX
INC X,DX
INC Y,DY
LOCATE X,Y
? "#"
And define this function below your loop.
DEF collission(X,Y)
IF X>50 THEN RETURN 1
IF X<0 THEN RETURN 1
IF Y>28 THEN RETURN 1
IF Y<0 THEN RETURN 1
RETURN 0
END
By the way DX and DY are the speed of the ball. If you want to detect a collision with the paddle, then you must compare the argument with the paddle's coordinates and the space it use. You should add that on collission(X,Y)