I would go with a sub-shell and two sed commands, something like this:
beg_tag='# BEGIN DYNAMIC BLOCK - DO NOT EDIT MANUALLY'
end_tag='# END DYNAMIC BLOCK'
(
sed "/^$beg_tag"'$/,$d' oldconf
echo "$beg_tag"
wget -O - http://$SERVER/get_config.php
echo "$end_tag"
sed "1,/^$end_tag/d" oldconf
) > newconf
Be careful not to put any sed-significant characters into beg_tag and end_tag.
This will append the output if no tags are present. The first sed command will never delete any lines from the input and the second sed command will delete all lines.
Testing
If oldconf contains:
(...content...)
# BEGIN DYNAMIC BLOCK - DO NOT EDIT MANUALLY
(... more content ...)
# END DYNAMIC BLOCK
(... even more content ...)
And the wget command is replaced by echo hello world, the output is:
(...content...)
# BEGIN DYNAMIC BLOCK - DO NOT EDIT MANUALLY
hello world
# END DYNAMIC BLOCK
(... even more content ...)
Now if the block is removed, i.e. the following input is used:
(...content...)
(... even more content ...)
The output is:
(...content...)
(... even more content ...)
# BEGIN DYNAMIC BLOCK - DO NOT EDIT MANUALLY
hello world
# END DYNAMIC BLOCK