Your code is correct:
# let a = "this is \"good\" code";;
val a : string = "this is \"good\" code"
# String.length a;;
- : int = 19
# print_string a;;
this is "good" code- : unit = ()
#
Perhaps you're confused by the \
characters in the output. The OCaml toplevel is writing the string in lexical form; i.e., in the form it should appear in an OCaml program. The \
escapes are not part of the string, as the length and the print_string
show.