The function sunrise-sunset is an interactive function takes a numeric prefix argument as a parameter. It does not take the latitude and longitude as parameters, which is what you're trying to pass into it. I suggest reading this emacs wiki article as well as of course the manual itself to learn more about prefix arguments. Also checking out the interactive ...
key-binding returns a function bound to a key, which you can ten call with funcall or call-interactively, so you can define your function call-function-binded-to-key like this:
(defun call-function-binded-to-key (key)
(call-interactively (key-binding key)))
It looks like you can call it like this:
(let ((calendar-latitude 40.1)
(calendar-location-name "Urbana, IL"))
This does not prompt you for the latitude and longitude, and puts a message in the minibuffer for those variable values.
I have the function now working to my satisfaction, as below, but am open to suggestions if I'm not doing things optimally. In the solution below, I use function read-file-name to prompt the user, and use condition-case to trap a user response of C-g, the quit signal, so that the default buffer file name is set for the buffer.
(defun my-write-test ()