sf::Err() is a standard stream, just like std::cout or std::cerr. It's an object that SFML uses to write errors, it's not a function that outputs something.
So you must redirect it at the beginning, and keep the ofstream alive as long as sf::Err() uses its streambuf (what rdbuf() returns).