how does its cosmic formation happens?
It is formed in supernovae by nucleosynthesis from lighter atoms.
Potassium
Potassium is formed in supernovae by nucleosynthesis from lighter atoms. 
where is potassium located in the human body cells how does it react chemically? It is chemically very similar to sodium. what is its use in medication? It is used as a medication in the form of potassium chloride to treat and prevent low blood potassium.
wiki:25673314
Potassium [SEP] Cosmic formation and distribution
Potassium is formed in supernovae by nucleosynthesis from lighter atoms. Potassium is principally created in Type II supernovae via an explosive oxygen-burning process. is also formed in s-process nucleosynthesis and the neon burning process. Potassium is the 20th most abundant element in the solar system and the 17th most abundant element by weight in the Earth. It makes up about 2.6% of the weight of the earth's crust and is the seventh most abundant element in the crust. The potassium concentration in seawater is 0.39g/L (0.039 wt/v%), about one twenty-seventh the concentration of sodium.