I do not think u need to be religious to write religious characters.
I do however believe u need to respect and study religion to write religious characters.
I will perish on the hill that the truly tragic hero of Star Wars, based on what we see in the films, is Count Dooku.
The only Jedi with the honesty to admit that the Republic was beyond salvation, the integrity to resign from an Order that was by definition complicit, and the sense of duty to lead those no longer willing to tolerate the corruption of Coruscant.
Anakin turned to the Dark Side for nepotism, Dooku for pure noblesse oblige. Were it not for the manipulation of Sidious, he would rightly have been remembered as one of the greatest heroes of the Galaxy.