Can I use flexible tube to replace a segment of copper pipe?
There are flexible hoses made for connecting to water heaters but they are usually only a few feet long and are only meant to make it easier to swap the heater for maintenance. They are also much larger, usually 3/4" size, because they are feeding the entire house. The hoses you show in the picture are 3/8" and are only meant to serve a single small fixture. 

If you are trying to go around obstacles consider using PEX tubing. You can connect a push-in fitting (like sharkbite) to the copper end and then run flexible PEX around the corner as long as you support it every few feet. However you may need to switch back to copper for the last 18" near the heater due to code restrictions on using PEX directly to the heater. The push-in fittings are more expensive but can be used for PEX to copper connections and require no soldering.