For example if i lose an encounter (as defense) my ships go to the warp. Say they get returned to me where would i put them? Because the rest of my home planets already have 4 and thought 4 was the max you could have on a planet. Obviously cant put them on the planet i just lost during the previous encounter just curious where i could put them.
When returning ships to your bases, you may put the token(s) on any bases where you currently have tokens.
Four is just the starting number, not the limit. You can have more than four.
(Note some rulesets call bases "colonies" instead. It's the same thing -- it just refers to your ships on a planet.)
The effect that tells you to get the ships back will tell you where you can put them. Whether or not there is a limit depends on where the ships are going. Normally, this will be to one of your colonies, which do not have a ship limit.
The effect that tells you to get the ships back will tell you where you can put them. Ships returned from the warp are usually placed on any of your colonies (a planet where you have ships). For examples, see the rules for the Regroup Phase, the rules for the defender rewards, and the rules for the Zombie power below.
[Regroup Phase:] During the Regroup Phase, the offense retrieves one of their ships from the warp and places it on any of their home or foreign colonies, stacking it on top of another one of their ships.
[Defender Rewards:] For each ship a defensive ally committed to the encounter, that player can ... Take one of their ships from the warp and place it on one of their colonies of their choice.
[Zombie Power:] Whenever you should lose ships to the warp, use this power to instead return them to any of your colonies and keep using them.
Note that a "colony" is any planet where you have ships:
Each stack of one or more ships on a planet represents one colony.
Not all warp-return effects do this. For example, the Invader flair super effect sends them into an encounter:
During an Invasion! encounter, you may retrieve ships from the warp to send into the encounter (the normal limit of four applies).
There is no limit to the number of ships a player can have on a colony. The four ships per colony is just during setup:
Set Up Warp, Planets, Ships, and Colonies: Players place their planets in front of them, stacking four of their ships on each of their planets.
However, there is a limit on the number of ships an attacking or allied player can bring to an encounter:
[Offensive Player:] After choosing a planet, the offense must decide how many of their ships to commit to the encounter. The offense must place one to four of their ships on the hyperspace gate.
[Ally:] When a player becomes an ally, they must commit one to four of their ships to the encounter.
Notice that the Invader flare card mentions that there is a limit of ships you can bring to an encounter, where return effects that send ships to colonies do not mention any ship placement limit (because there isn't a ship placement limit for colonies).