sure, one item at a time ..
Do you know what the DXF 66 does ?
(setq ss (ssget "_X" '((0 . "INSERT") (66 . 1) (cons (2 blockNameToFind)))))
Think about passing the getdata function the blockNameToFind
Think about returning the required info to the calling routine ;
ie : (setq val (getdata blockNameToFind) )
Think about localising your variables.
Think about testing the length of the selectionSet and advising the user that there is more than ONE block in the drawing.