Apparatus for forming or coating the pipes