It's not clear what your actual problem is, but you should write the code like this:
# Don't use ls. Just let the glob expand to the list of files
array=( ./COS/cos*.txt )
# Don't iterate over array indices; just iterate over the items themselves
for fname in "${array[@]}"; do
do
# Are you trying to add a carriage return to the end of each line?
sed "s/\$/$'\r'/" "$fname" > ./COS/temp.txt
mv ./COS/temp.txt "$fname"
done
You don't even need the array; you can simply put the glob in the for loop:
for fname in ./COS/cos*.txt; do
...
done