Medications have to be prescribed by a licensed Medical Doctor only.
A psychologist, therapist, counselor, etc. has no ability to do this.
Often psychiatrists will work with a psychologist, therapist, counselor to make sure that the patient gets what they need. The psychiatrist may ask to see the patient alone or may rely on the medical observations of the psychologist to make the diagnosis and prescribe medication.
How long do you stay on medication? That entirely depends on your illness.
As you know some medical illnesses will be resolved with medication over time. But other medical conditions such as diabetes or even asthma are chronic and life-long and require a doctor's care as well as the medications. And so it depends on what you illness is.
Can a doctor write a prescription for life? No. They used to be able to do that and the pharmacy used to keep the script on file as a PRN (Per Required Need). But this is considered really bad medicine today and no doctor would risk his or her license by prescribing for life without regular medical follow ups. So, no.
Why do you have to see the doctor? Well, the doctor needs to see you and examine you to ensure the effectiveness of the medication, that you still need it and that it isn't having any serious side effects that are harming you. And so they will ask to see you for a medication review every 6 to 12 months or so. If you fail to keep your appointment, your medications will not be refilled.
If you have the kind of medications that you need to stay on, you need to keep your appointments.