If the tooth has a cyst does it need to be removed or it can be treated endodontecly?

Endodontics. You can have root canal therapy to treat the cyst and does not have to be extracted.
Your choice. The tooth that is in question has to be examined to make an accurate decision about its potential treatments. If the tooth is fractured deeply to the bone, it may not be salvageable. If there is simply localized infection having a root canal (endodontics) is a great way to save the tooth. Ultimately the decision lies with you. After receiving the possibilities of treatment, you get to decide.
Cyst or abcess? There is a difference between a cyst and an abcess. If it is truly a cyst, then the cyst must be removed surgically. If it is an abcess, and if there is enough tooth structure that is healthy for a restoration, then endodontic treatment (root canal) is possible. If there is an abcess and not enough healthy tooth structure, then the tooth would need to be extracted.