It is appropriate to remove it
The first it refers forward, to to remove
The second it refers backward, to something in a previous sentence.
We will need to check whether the it precedes a clausal verb (ToBeAppropriate is a clausal verb) supporting an infinitive.
They held a party. It was a disaster.
We have three possible objects it cant be they, but it could be ToHold or party party is more like disaster than ToHold.
They held a party. It was necessary to hold your ears.
We look forward to find the clausal and the infinitive this is a neater form of
To hold your ears was necessary.
We can have the situation where the it matches forward and backward.
He had an idea. It was that the farm should run at a profit.
We look across the clausal verb to find a clause, then look back to find a clausal object idea will do. Using linkages, we have made the form
He had an idea. (The idea) was that the farm should run at a profit.
Otherwise, it can match any object or relation of single form. We can use the context of the it to filter the possible objects. In the above example, it refers to something that can be removed. We probably need to fill in some context before searching for it if we know that it is removed from a document, then we rule out many objects that do not fit in a document.
We will rapidly get into the situation where we have multiple possible objects and multiple possible contexts, and need to check them pairwise for reasonableness.
See Anaphora