input to keep adding number to one field in database

Right, simply wrap your code like that:

import ...

$w.onReady(function() {
    // put the code here
})