who wrote it?
Michael O'Donoghue
The Last Voyage of the Starship Enterprise
 written by Michael O'Donoghue during a month-long process consulting with actor John Belushi. 
what was the last voyage of the starship enterprise? It is a comedy sketch that first aired on May 29, 1976, during episode 22 of the first season of the NBC variety show, "Saturday Night Live".
wiki:2544670
The Last Voyage of the Starship Enterprise [SEP] Introduction
"The Last Voyage of the Starship "Enterprise"" is a comedy sketch that first aired on May 29, 1976, during episode 22 of the first season of the NBC variety show, "Saturday Night Live". The twelve-minute sketch was written by Michael O'Donoghue during a month-long process consulting with actor John Belushi. The sketch is a satire of the 1969 cancellation of "". The set design featured an effective replica of the bridge of the USS "Enterprise". Dress rehearsal was difficult, with the writer doubting whether Belushi was able to pull off an effective parody of William Shatner's performance as Captain James Kirk.