Your list of Detail Items is a list of instances. You want to change the name on a list of types. You just need to get and filter the correct list of elements.
Either use the existing list of Types (duplicated for all instances) and filter down to unique values only, or change your method of gathering elements to be specific to Filled Region Types from the beginning.
There’s also no need to filter for types with your string condition. String.Replace will only replace the substring value where it exists. If it doesn’t exist, the string will remain unchanged.
Yeah but, it looks like the name already exists, so you cant change another name to that same name as they are unique:
You first have to Rename any possible duplicates with a temporary suffix, then rename the one you want to rename, and then rename your placeholder again