Swedish Prime Minister Stefan Lofven says he intends to remain in the job, despite losing seats to an anti-immigrant party in his country's election.