She sat, day after day, in a baggy sweat suit in front of her rented IBM Selectric. The classic face, a cameraman's delight, was devoid of makeup. The world outside her Manhattan duplex was less than a distraction: To her, it didn't exist. Time was measured in sentences. Rewards were basic. "Two paragraphs, cookies. Three pages, a sandwich," remembers Candice Bergen. "Life was a running buffet."

Yet it wasn't, she hastens to point out, a banquet. The task of completing her first literary opus last August was far more difficult for actress Bergen, 37, than saying lines others had written on a film set. Candy's torment was palpable to her friends, who took bets she would never finish the book. And the author's husband, film director Louis Malle, 51, found himself getting testy when Candy suddenly began scribbling notes as they were getting ready for bed. "My God," he complained. "It's like being married to Flaubert."

But finally, six years after she signed a contract to write about her life, the actress is a published author. Knock Wood (Linden Press/Simon & Schuster, $15.95) is her bittersweet account of what it was like to grow up as the daughter of America's beloved ventriloquist Edgar Bergen. No celebrity tell-all, Knock Wood is an intelligent, often self-deprecating probing of her past. Others might have relegated such material to the psychiatrist's couch, but not Bergen.

She contemplates all this one afternoon in her duplex, with its double-height living room and sweeping view of New York's Central Park. "Louis says he married me for this apartment. I say I married him for his house in France. We're sort of a real-estate couple," cracks Candy. For the moment Louis is off in Texas directing a drama called Alamo Bay. Bergen is alone, surrounded by the testimony of her lifelong wanderlust: an opium pipe from Burma, an ostrich egg from Ethiopia, a Thai Buddha. A silver box engraved with the profile of Charlie McCarthy, her father's smart-aleck dummy, rests on a table.

Charlie's image looms large in her life. He was, after all, the Bergens' bread and butter and very much a member of the family. Charlie had his own room in their Bel Air home, his own wardrobe, even his own furniture. And, yes, sometimes Candy was jealous of the hold he had on her father. Edgar Bergen, who died at 75 in 1978, was a remote, sometimes moody man. He doted on his beautiful Alabama-born wife, Frances, and on his daughter and her baby brother, Kris, now 22. But Bergen expressed his feelings best through his dummy, Charlie.

"The book was a way to resolve my relationship with my father," explains Candy. "When I began, all I had in mind was this vague notion I wanted to write a kind of personal Passages, a book about coming of age, and not a celebrity memoir. That would have been presumptuous and premature."

Nor did she want to sound self-pitying or ungrateful. "It's almost a rule that children of celebrities have to write about their misery as the plight of the overprivileged," she says. Yet Bergen is candid about the pitfalls of an overripe, overstimulated Hollywood adolescence. Emerging from a childhood in which she attended birthday parties with Liza Minnelli and Vicki Milland and called Walt Disney "Uncle Walt," Candy became a spoiled, stubborn teenager. At 14, she insisted on enrolling in Montesano, a Swiss boarding school. When her parents arrived for a Christmas visit, they found her with a platinum rinse on her hair, lighting up cigarettes and ordering "un Bloody Mary" at a bar. "There was my baby, my little darling. I was pretty shaken," recalls Frances Bergen.

Candy's college years brought new rebellions. As a sophomore at the University of Pennsylvania, she was too busy enjoying her instant success as a magazine model to study subjects she didn't like, and she flunked out. She rebounded by accepting her first movie role, that of the lesbian Lakey in Mary McCarthy's The Group. "I would rather she had played an ingenue," notes her mother. But Candy was hailed as "the new Grace Kelly" for her cool performance and striking beauty.

About this time (1966, when she was 20), an increasingly troubled Bergen began giving interviews in which she put down her childhood, Beverly Hills and its "vinyl trees," and "the provincialism" of her college campus. Reflecting on that period, she is analytical: "It was overwhelming to have that much success so quickly. My way of dealing with it was being arch and glib and defensive to cover my fear."

But finally, thanks to age and experience, Candy has mellowed. "It takes a long time to grow up. Longer than they tell you," she writes. She attributes her present contentment in large measure to Malle, whom she married in 1980. When a rumor surfaced recently that she and Malle had separated, Bergen was livid and issued a swift denial. "It made me want to kill," she says. "My marriage is the keystone of my life." Louis, in turn, says of the relationship: "I feel for the first time that I belong, that I'm not alone."

The marriage has not, however, been without sacrifice. After finally proving her mettle as a talented comic actress in such films as Starting Over and Rich and Famous, Bergen has cut back on her career since her wedding. "I don't want to jeopardize our marriage. As much as I want to work, I don't want the absences from Louis," says Bergen, who tries whenever possible to visit him on location. "You can act and sustain a close relationship, but very judiciously."

She nevertheless has played the evil sorceress Morgan le Fay in a CBS epic, Arthur the King, scheduled for May. Bergen also took time away from Malle to play "a cool blonde," as she puts it, in Burt Reynolds' film Stick, due this fall. Another role she is considering, with ongoing inner debate, is that of mother: "I'd better decide soon. I would love to have kids, but I'm not sure how I would work it in terms of time. We don't have a fixed life."

This summer the Malles will take off for his 18th-century ch√Ęteau in southern France. There they will ride bikes and picnic with Malle's daughter, Justine, 9, and son, Cuote, 12 (by his liaisons with two European actresses). "I'm very close to them, especially Justine," says Candy, "but it's not the same as having your own."

For the moment she is concentrating on the birth of her book. Candy has no immediate plans to start another and still has not gotten over how traumatized and impressionable she proved as a writer: "I would read Tom Wolfe and find myself affecting his style." But most of the time she felt like Leo Tolstoy. "It could have been War and Peace for the agony I went through," Candy groans, adding with that old Bergen glibness, "but the results were not commensurate."