First thing that pops to my eye are the script tags. In the group description most of the script is placed after </script>. That's not correct.
You seem to have modified the function itself and replaced all occurrences of qID and filterqID in the function itself. The purpose of a function is to just save that kind of work.
var qID : the number of question to filter
var filterqID : the number of question filtering
Usually you leave the function sourcecode untouched and just execute the function itself with values instead of the variables.
selectFilter_selectFilterByCode(here the real qID as a value or a ExpressionManager variable, Here the real filterqID as a value);
I haven't read the whole code. So take it with a grain of salt.
You seem to have modified the function itself and replaced all occurrences of qID and filterqID in the function itself. The purpose of a function is to just save that kind of work.
var qID : the number of question to filter
var filterqID : the number of question filtering
Usually you leave the function sourcecode untouched and just execute the function itself with values instead of the variables.
selectFilter_selectFilterByCode(here the real qID as a value or a ExpressionManager variable, Here the real filterqID as a value);
I haven't read the whole code. So take it with a grain of salt.