Hello Crayon, your programm can't work properly anyway, it is not a problem of amount of memory
I think you should take a look at the programing manual so you could use correctly variables, input command or conditions (IF, THEN....).
Here is an online manual http://www.worldofspectrum.org/ZX81BasicProgramming/

As an example, look at chapter 10 and at those lines, you may re-use them in your program if you adapt it a little.