Making a calculator: What is missing in this loop?

I want every time you press on a key (in any < button > with the "key" class) the number is added to the input

Then I have done this:

/ * VAR RESULT * /
var input0 = document.getElementById ("input0");

var keys = document.querySelectorAll ('. key');

function add () {
    input0.value = keys.value;

for (var i = 0; i <keys.length; i ++) {
    keys[i].addEventListener ('click', add);

With the last loop if I press any key with the class "key" it appears in the "undefined" input. I have tried to put keys.value in the variable declaration but then it gives the error "Can not read property 'length' of undefined"