The lines in the file :
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2000 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2001 -j ACCEPT
-A
Yes, to comment line containing specific string with sed, simply do:
sed -i '//s/^/#/g' file
And to uncomment it:
sed -i '//s/^#//g' file
In your case:
sed -i '/2001/s/^/#/g' file (to comment out)
sed -i '/2001/s/^#//g' file (to uncomment)
Option "g" at the end means global change. If you want to change only a single instance of pattern, just skip this.