If i want to run function when buffer "k" is saved, is there a better way to do this, then just using add hook and checking buffers name in function?
You do not need to check the buffer name. Just add the hook buffer-locally.
See the doc of
The optional fourth argument, LOCAL, if non-nil, says to modify the hooks buffer-local value rather than its global value. This makes the hook buffer-local, and it makes t a member of the buffer-local value. That acts as a flag to run the hook functions of the global value as well as in the local value.
The fourth argument with value
t says that the hook is buffer-local:
(add-hook 'after-save-hook #'your-function nil t)