End of the Line

End of the Line is an Institute main quest in Fallout 4.

Speak with Father
Father will ask what the player thinks of the directorate's intention to destroy the Brotherhood of Steel. Even if the player says that it is a mistake to do so, Father will insist that it is the only right decision because otherwise the Institute will be destroyed. He then reveals that the player's involvement with the Railroad is known and asks whether they are ready to turn on the Railroad. Even if the player says that they are allies and argues to save them, he wants them to destroy the Railroad. If the player refuses, Father will say it is an order. If the player says they are not allies or has failed Tradecraft, there will be no option to warn Desdemona; when going to talk to her, she will say that the Railroad is aware of player working with the Institute and asks them to leave, and the rest of the Railroad will be dismissive of them.

Kill Desdemona
When arriving at Railroad HQ, the next step can be approached multiple ways, but will end in one of two results.

1. Siding with the Institute - Killing Desdemona

The moment the player fires a shot at someone, everyone in the Railroad HQ will turn hostile. Glory is the biggest threat of the faction. She uses a minigun and is equipped in heavy armor. The rest of the faction will use unmodded pistols, aside from Deacon who will use whatever weapon he has on him at the time. If Deacon is not at HQ when the player character attacks, he will likely be walking around the Commonwealth. He will have to be chased down to proceed with the mission. After killing the leaders of the Railroad, return to Father. He tells about a plan to drive the Brotherhood of Steel out from the Commonwealth to discourage them from returning. This plan is about teaching the Brotherhood that the Institute at any time and place can turn their own technology against them. The player character is instructed to the speak with Doctor Li/Doctor Watson about this. End of the Line is completed and Airship Down begins. If the Prydwen was already destroyed in Rockets' Red Glare, then End of the Line is completed and Nuclear Family begins.

2. Siding with the Railroad - Warn Desdemona

To keep one's allegiance with the Railroad, they must inform Desdemona about the Institute's orders for the Railroad's execution. She will tell the player to stall for time and continue working with Patriot. One will at that point need to do a long series of quests, starting with Underground Undercover, before End of the Line fails. There is no reward for this outcome, but the player character gets to remain a member of the Railroad. If all objectives have been completed for Underground Undercover prior to speaking with Z1-14 to advise that the rebel synths are ready to fight for their freedom, he discovers that the Brotherhood of Steel has found the Railroad HQ and asks the Sole Survivor to warn Desdemona as quickly as possible. Speaking to Desdemona will complete Underground Undercover and start Precipice of War.

Bugs

 * Quest will not progress on the (Eliminate the Railroad leaders) stage even though all of them are killed. A fix is by completing the stage using the console:
 * Quest won't progress - an alternate issue: If you warn Desdemona about the Institute's plans, the Brotherhood of Steel begin to attack both the Sole Survivor and the Railroad. If at this point one changes their mind and decides to kill both parties present (the Brotherhood and the Railroad), one may not be able to kill Glory - oddly though she is not hostile towards the Sole Survivor - the fix for this is the same console command as the previous bug:
 * Quest will not progress - a third issue: If the player has previously eliminated the Brotherhood of Steel presence on the Prydwen, they will be unable to warn Desdemona, and therefore be unable to proceed to Rockets' Red Glare or The Nuclear Option (Railroad) if the player wishes want to play the Railroad's endgame. One can still end the game on friendly terms with the Railroad by getting banished from the Institute and then completing The Nuclear Option (Minutemen).
 * The player will be unable to access Railroad HQ where Desdemona is, if before siding with the Institute the player has already started the quest Tactical Thinking from the Brotherhood of Steel. The secret passage will be locked, and the player will not be able to interact with the mechanism to open it. This link shows a glitch that breaks through the wall. On PC, use  to toggle clipping off before using the glitch and then back on once through the wall.
 * If one manages to kill all essential targets quick enough while sneaking it is possible for P.A.M. to stop being hostile and continue giving quests for the Railroad.