A retired surgeon has published his first novel, inspired by Swindon's railway history.