It's not clear, either from the script or the source novel what Lecter's motivation for engaging with Agent Starling was, but we do know that Lecter has been planning an escape for some considerable time. He clearly sees the visits he's been receiving (from Clarice, Jack Crawford and various other unnamed psychologists) as a potential source of material for his needs.
It strikes me as highly likely that he'd want to encourage future visits from Clarice, who he sees as quite skittish and hence more prone to making mistakes. Obviously the best way to do this is to give her a good reason to return:
In all the years after he savaged the nurse in the Baltimore asylum,
there had been only two lapses in the security around him, both on
Barney's days off. Once a psychiatric researcher loaned him a
ballpoint pen and then forgot it. Before the man was out of the ward,
Dr. Lecter had broken up the plastic barrel of the pen and flushed it
down his toilet. The metal ink tube went in the rolled seam edging his
mattress.
The only sharp edge in his cell at the asylum was a burr on the head
of a bolt holding his cot to the wall. It was enough. In two months of
rubbing, Dr. Lecter cut the required two incisions, parallel and a
quarterinch, long, running along the tube from its open end. Then he
cut the ink tube in two pieces one inch from the open end and flushed
the long piece with the point down the toilet. Barney did not spot the
calluses on his fingers from the nights of rubbing.
Six months later, an orderly left a heavyduty paper clip on some
documents sent to Dr. Letter by his attorney. One inch of the steel
clip went inside the tube and the rest went down the toilet. The
little tube, smooth and short, was easy to conceal in seams of
clothing, between the cheek and gum, in the rectum.