End of the Line

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

Detailed walkthrough
Father will ask what you think of the Directorate's intention to destroy the Brotherhood of Steel. Even if you say 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 informs you that your involvement with the Railroad is known and asks if you are ready to turn on the Railroad. Even if you say that they are your allies and argue to save them he wants you to destroy them. If you refuse, he will say 'it is an order'. If you say they are not your allies, you will not have the option to warn Desdemona. when you go to talk to her, she will simply ask you to leave and the rest of the Railroad will be dismissive of you.

When you arrive 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 you fire 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. It is recommended you focus on taking her out of the picture first before everyone turns their gun on you. 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 isn't at HQ when you attack, he will likely be walking around the Commonwealth. He will have to be chased down for you 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. You are instructed to the speak with Dr Li about this. The quest completes and the next starts.

2. Siding with the Railroad - Warn Desdemona

To keep your allegiance with the Railroad, you must inform Desdemona about the Institute's orders for the Railroad's execution. She will inform you to stall for time and continue working with Patriot. You will at that point need to do a long series of quest, starting at Underground Undercover, before End of the Line updates, and informs you that the quest failed. There is no reward for this outcome, but you get to remain a member of the Railroad.

Bugs

 * Quest won't 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 you change your mind and decide to kill both parties present (the Brotherhood of Steel and the The Railroad) you 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: -- Please can someone else verify if this happens to them?Verified on PC
 * Quest won't progress - a third issue: If you've previously eliminated the Brotherhood of Steel presence on the Prydwen you'll be unable to warn Desdemona, and therefore unable to proceed to Rockets' Red Glare or The Nuclear Option (Railroad) if you want to play the Railroad's endgame. You 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. For  PC, use the console command tcl to toggle clipping off before using the glitch and then back on once through wall.