Raspberry Pi sometimes detects wrong keypad number
I don't know how quickly a Raspberry Pi will execute your code but I think the most likely explanation of your problem is that you are changing the output line and not giving it a chance to stabilise (and for the previous one to turn off).
GPIO.output(line, GPIO.HIGH)
if(GPIO.input(C1) == 1):
        print(characters[0])

Try introducing a delay in between the first and second line above. (If there isn't a handy delay function then give it a cubed root to solve!)