The ssget function can only search the drawing database for primary entities, not subentities such as attributes/vertices.
Therefore, you have two options: the first would be to iterate through all attributed blocks in the drawing, then single out those that have more than 20 attributes:
(defun GetBlocksWithMoreThan20Attribs ( / at en i ss )
(if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
(repeat (setq i (sslength ss))
(setq en (ssname ss (setq i (1- i)))
at 0
)
(while (eq "ATTRIB" (cdr (assoc 0 (entget (setq en (entnext en))))))
(setq at (1+ at))
)
(if (< at 20)
(ssdel (cdr (assoc 330 (entget en))) ss)
)
)
)
ss
)
The second would be to iterate through the block table, and collect the names of blocks with more than 20 attribute definitions, then create a selection set of these blocks.
(defun GetBlocksWithMoreThan20AttDefs ( / at bd be bl nm )
(while (setq bd (tblnext "BLOCK" (null bd)))
(if (= 2 (logand 2 (cdr (assoc 70 bd))))
(progn
(setq at 0
nm (cdr (assoc 2 bd))
be (tblobjname "BLOCK" nm)
)
(while (setq be (entnext be))
(if (eq "ATTDEF" (cdr (assoc 0 (entget be))))
(setq at (1+ at))
)
)
(if (<= 20 at)
(setq bl (cons "," (cons nm bl)))
)
)
)
)
(ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 (apply 'strcat (cdr bl)))))
)
The second method will fail however if attributes have been added to the block outside of the block definition, but this is an unlikely case.