It's because the values are numbers and they need to be strings to write to a file:

Note that the 'getvisibilities' function is only returning allowed values on the first item not all dynamic properties:
(car (vlax-invoke blk 'getdynamicblockproperties))
Try this mod, will export the following properties:

(defun c:test (/ e visibilities path f)
(if (and (setq e (car (entsel "\nSelect dynamic block w/ visibilities: ")))
(setq visibilities (getvisibilities e))
)
(progn (setq path (strcat (getvar 'dwgprefix) "BlockVisibilities.txt"))
(setq f (open path "w"))
(foreach v visibilities (write-line (vl-princ-to-string v) f)) ;foreach
(close f)
) ;progn
;else
(prompt "\nNo visibilities found.")
) ;if
(princ)
) ;defun
(defun getvisibilities (blk / vlist) ;blk - ename, of block w/ visibilities to retrieve
(setq blk (vlax-ename->vla-object blk))
(if (= (vla-get-isdynamicblock blk) :vlax-true)
(foreach vis (vlax-invoke blk 'getdynamicblockproperties)
(setq vlist (cons (list (vlax-get vis 'propertyname)
(vlax-get vis 'value)
(vlax-get vis 'allowedvalues)
)
vlist
)
)
) ;foreach
) ;if
) ;defun