Not sure what's going on there. The duplication should only happen if you have duplicate values in the relationshipLists.
In general, it's far better to store your script in as file and reference it with the Content Link in the CEWP.
M.
In general, it's far better to store your script in as file and reference it with the Content Link in the CEWP.
M.