When you say, 'gets stuck' I'm assuming you mean it errors, as a repeat expression cannot enter an infinite loop by its definition.
The error would most likely be caused by a null SelectionSet since your filter list will filter out all entities.
By default, the filter list will match all entries using an AND operation, i.e. all conditions in the filter list must be met.
To filter for more than one object we require an OR operation, which can be achieved in one of two ways:
Using the wcmatch OR:
(ssget '((0 . "TEXT,MTEXT")))
Using the -4 filter OR:
(ssget '((-4 . "<OR") (0 . "TEXT") (0 . "MTEXT") (-4 . "OR>")))
I would use the first one.
Lee
EDIT: When working with SelectionSets, be sure to test for a valid SelectionSet before proceeding to use ssname/sslength/ssmemb/ssdel etc. As SelectionSet functions will error if passed nil for the SelectionSet argument.
i.e.
(if (setq ss (ssget ... ))
-- Your Code Here --
)