I have bought an LG lj594v and an LG sh4d soundbar. What is the best way to connect as tv has only hdmi arc and one other hdmi

TV optical audio output to soundbar optical audio input with toslink optical audio cable.
Check the TV manual on how to turn on and configure the optical audio
Select optical audio as your input on the soundbar. You may need to change the audio output type in the TV audio menu to get sound.