Property was in mortgaged state without knowing to us while purshing the property

We Purchased a flat from a builder in 2018 which was a redevelopment project, now the project is completed and we have paid all the money to the builder and we got the possession letter for the same and we are staying in that flat. Now we got to know that our flat was mortgaged by the Builder before our agreement was registered. Some people from that investment company came to the flat and they informed us that this property is mortgaged and many other flats are also mortgaged in the same building. Post that we had a meeting with the builder, and he is saying he is doing a settlement with them and he asked us to join with us to get the stay on this. I am also worried about how is possible that banks have given a loan on it, many flat owners have taken loan on their mortgaged flat. Now we don't know what to do as we haven't received any official notice from the investment company only persons came and informed us, we asked for the list of flats that are mortgaged they said we have shared it with the builder. Please help what to do in this case, and builder is saying I am doing it. also, we got to know there are 2 to 3 flats that are unsold and he is going to register that on this name as soon as possible.