About this quote from Harry Potter And The Sorcerer's Stone:
He understood what he had to do all right, it was doing it that was going to be the problem.
I think that it is better to add a conjunction between the two clauses to make it correct in grammar.
He understood what he had to do all right, (and/but) it was doing it that was going to be the problem.