How do you transfer a game from p.c to xbox and ps4?

Sounds early to be asking but I’m wanting to know is how can you get your game to support the xbox and the ps4 with it been made only for p.c? do you have to code the game or something for it to work or do you just contact the people who made them to ask if you can sell your game on the xbox or the ps4 ect

You have to apply to be added to Xbox or Playstation developer programs, if you get accepted then you can provide your developer info to Epic and then they will grant you access to a version of the UE4 editor that supports that console. To be accepted though you have to have a legitimate use, meaning not just for a hobby but for a project you will actually release or you’re an established developer.