You are using ^string-to-be-replaced$
, it means a line starts with the string and ends when string ends. If your line contains more than one string, it will not be replaced. Suppose your line contains:
1234526589745862 any-text-here 12345652145874589 12345254121269856 some-more text
Your code will not replace this, because this line starts with your string pattern but not end with it.
Do not use ^$ in your code, it means it will replace a string which starts with 12345 and it has 17 characters and it is the only string in the line.
Ex- a line contains
That's it. No more character before it and no more after it.
sed 's/12345.........../12345###########/g' /path/of/your/input/file
If you want to change in the file direct, use sed -i
but it is dangerous first take back up and then change directly.