There is no legitimate in-game option for infinite health in Battlefront II. On the PC, the closest thing is the mod and add-on scene, where the community has produced plenty of single-player tweaks over the years.
Mods only apply to offline play, and installing anything from an unknown source is a good way to end up with malware instead of a buff. Stick to established mod repositories, read the comments, and keep your online play clean — modified files in multiplayer will get your account closed.