I am not getting/understanding exactly what you want to do, but there are a few things that are causing you grief.
As @afelix explained you need to set things up first to allow what you are trying to do to happen.
So, one way:
You will need to edit the
settings.js file of node-red.
There is a
httpStatic part which allows node-red to access files on the machine. Or something like that. I don't have the vocabulary to explain it much better.
But basically you set something up like:
(DO NOT FORGET THE END COMMA!)
That then allows directories/files below there to be accessed.
So you will have to change where the file is saved to that path also.
Then you may get closer to doing what you want.
So say you put it in THAT directory. (/home/pi/.node-red/public/)
Then in your "template" the line would be:
<form action= "log_k.csv" method="download">
The path (/home/pi/.node-red/public/) is implied from the line in the settings.js file.
Does that help?