Without seeing your table structure, I can only guess what you want.
A simple subquery for what you want would be included in your WHERE clause and might look like this:
WHERE ...<existing clause>...
AND cte.InstallmentId in (Select InstallmentId from Installments where flag = 'paid')
Now that subquery can be as simple or as complex as you need it to be, but it should return a list of a single column that you can query with an "IN" clause.
If you need multiple columns, you can also JOIN to a subquery.
In your table section you can do
FROM ...<existing from clause>...
LEFT OUTER JOIN (Select InstallmentId, Age from Installments where flag = 'paid') as I on cte.InstallmentID = I.InstallmentID and cte.Age = I.Age
Hopefully that is enough to get you going.
Brent