Try do this easiest way.
REM Developed in QBasic by Omer B. Hijazi
REM Date: 1/4/2020
REM Etch a Sketch
SCREEN 12
COLOR 15
X = _WIDTH / 2
Y = _HEIGHT / 2
DO
LOCATE 6, 28: PRINT "Use arrow keys to draw"
LOCATE 7, 28: PRINT "Home to move drawing point"
LOCATE 8, 21: PRINT "Del(ete) button to clear the screen"
LOCATE 9, 34: PRINT "End to end"
k& = _KEYHIT
SELECT CASE k&
CASE 18432: Y = Y - 1
CASE 19200: X = X - 1
CASE 20480: Y = Y + 1
CASE 19712: X = X + 1
CASE 21248: CLS
CASE 18176: SYSTEM
END SELECT
PSET (X, Y)
SELECT CASE X
CASE IS <= 0: X = 1
CASE IS >= _WIDTH: X = _WIDTH
END SELECT
SELECT CASE Y
CASE IS <= 0: Y = 1
CASE IS >= _HEIGHT: Y = _HEIGHT
END SELECT
LOOP UNTIL _KEYDOWN(20224) = -1
SYSTEM
or this, using _KEYDOWN + support pressing direction arrows simultaneously for oblique drawing (up and left arrow can be used simultaneously and so on):
REM Developed in QBasic by Omer B. Hijazi
REM Date: 1/4/2020
REM Etch a Sketch
SCREEN 12
COLOR 15
X = _WIDTH / 2
Y = _HEIGHT / 2
DO
LOCATE 6, 28: PRINT "Use arrow keys to draw"
LOCATE 7, 28: PRINT "Home to move drawing point"
LOCATE 8, 21: PRINT "Del(ete) button to clear the screen"
LOCATE 9, 34: PRINT "End to end"
_LIMIT 20
IF _KEYDOWN(18432) AND NOT _KEYDOWN(19200) THEN Y = Y - 1
IF _KEYDOWN(19200) AND NOT _KEYDOWN(18432) THEN X = X - 1
IF _KEYDOWN(19200) AND _KEYDOWN(18432) THEN Y = Y - 1: X = X - 1
IF _KEYDOWN(20480) AND NOT _KEYDOWN(19712) THEN Y = Y + 1
IF _KEYDOWN(19712) AND NOT _KEYDOWN(20480) THEN X = X + 1
IF _KEYDOWN(19712) AND _KEYDOWN(20480) THEN Y = Y + 1: X = X + 1
SELECT CASE _KEYHIT
CASE 21248: CLS
CASE 18176: SYSTEM
END SELECT
PSET (X, Y)
SELECT CASE X
CASE IS <= 0: X = 1
CASE IS >= _WIDTH: X = _WIDTH
END SELECT
SELECT CASE Y
CASE IS <= 0: Y = 1
CASE IS >= _HEIGHT: Y = _HEIGHT
END SELECT
LOOP UNTIL _KEYDOWN(20224) = -1
SYSTEM