The lines you quote actually come from the 1995 film version directed by Ang Lee with script written by Emma Thompson. Though there are a lot of similarities between the film and the actual novel, some liberties were taken. The lines do indeed refer to the scene that takes place in Chapter 37 of the actual novel. However, those exact lines, word for word, are not found in the novel. The closest similarity are Elinor's closing lines to a speech directed at Marianne:
--Then, if I had not been bound to silence, perhaps nothing could have kept me entirely--not even what I owed to my dearest friends--from openly shewing that I as very unhappy. (Ch. 37)
However, though the lines in the film differ from Austen's actual words, the sense is still the same. In this scene, Marianne is trying to grasp how Elinor could have suffered in silence for so long, if she did suffer at all. Elinor is trying to explain that she put her sense of duty and of love for others above her grief and controlled her emotions. She explains that while she loved Edward, she "did not love only him"; she loved her family as well and was happy to spare them from learning about Edward's engagement, which would have distressed them as much as it did her. In addition, she had a duty to Lucy to fulfill. She promised Lucy absolute secrecy. Hence, she argues that had she not promised Lucy complete secrecy, all of Lucy's exultation and Elinor's own knowledge that Edward did not feel indifferently towards her, would have driven her to show just exactly how much pain she was feeling.