Generate next available filename based on current date
Your code can be made much simpler:

var basename = today;
var filename;
for (var k = 0; fs.existsSync(filename = './' + basename + '.pdf'); k++) {
    basename = today + ' (' + k + ')';
}
return filename;