It's saying that on the tenth line of your script, you're attempting to combine a string together with nothing.
Looking at the code you've posted, there's a bit of a mis-match in you're only attempting to concatenate on the ninth line. The string is obviously "print", so "text" must be nil.
This suggests that your file only contains one single line. After you've read that one line, your second attempt to read a line isn't going to "get" anything out of it.
You could prevent the error by first checking whether "text" exists (in much the same way as you checked to see if you got a valid file handle), but then you run into problems in interpreting what "text" contains - I can tell you it'll never contain "print"..text, because if you take any word (or sequence of words) and stick "print" in front of them, the result will never be the same as the original.
Really you'd want to check whether the text
starts off with something along the lines of "print(". The problem with
that is that there's a whole lot of different ways that line can be written - what if there's some spaces padding it out? What if it's sharing a line with an if/while/for/whatever statement? Extracting the true meaning of the line isn't exactly simple.
And that's not even scratching the surface of what writing an interpreter entails - so I suggest you choose a different project, as this one will likely lead to frustration when you start to realise exactly what you're diving into.
That said, if you really want to keep on with it, then I suggest
reading about patterns. You'll need a deep understanding of them.