I found this very old Hymn, which I think it is clearly based on, although it has been changed.
I suspect that the writer Ian La Frenais changed it for the programme, or maybe Lovejoy forgot bits, and just made it up, on the spot !
Hymn 151
Leaving the world
Farewell vain world, I must be gone,
I have no home, nor stay in thee;
I'll take my staff and carry on,
Till I a better world can see.
2. Why art thou loth my heart, O why,
Dost thou recoil within my breast ?
Grieve not but say, farewell and fly
Unto the ark, my dove there's rest.
3. I come my Lord a pilgrim's pace,
Weary and weak I slowly move;
Longing but yet can't reach the place,
The gladsome place of rest above.
4. I come my Lord the floods here rise,
These troubled seas foam nought but mire;
My dove back to my bosom flies,
Farewell poor world heaven's my desire.
5. Stay, stay, said earth, whither fond one,
Here's a fair world, what wouldst thou
Fair world O no, thy beauty's gone, (have?
A heav'nly Canaan Lord I crave.
6. The ancient travellers thus they,
Weary of earth sigh'd after thee ;
They're gone before I must not stay,
Till I both thee and them may see.
7. Put on my soul put on my speed,
Tho' long the way, the end is sweet,
Once more poor world farewell indeed,
In leaving thee my Lord I meet.