Optical bistability and entanglement in two optically coupled cavities under the effect of a nonlinear medium