Sed : Substitude all characters between two string by char 'X' : In a bas script, i am trying to in-file replace the characters between two given strings by 'X'. I have bunch of string pair, between which I want the replacement of characters by 'X' should happen.

This is what I am doing.

    declare -a cpi_list=('%26Name%3d' '%26Pwd%3d')
    myAnd=\%26
    newfile="inputlog.txt"
    
    for item in "${cpi_list[@]}";
    do
        sed -i -e :a -e "s/\($item[X]*\)[^X]\(.*"$myAnd"\)/\1X\2/;ta" $newfile;
    done

The input  
    `CPI.%26Name%3dJASON%26Pwd%3dBOTTLE%26Name%3dCOTT`  
I want to make it  
    `CPI.%26Name%3dXXXXX%26Pwd%3dXXXXXX%26Name%3dXXXX`

But somehow it is not working.

Please help.