Shylock's main aim was to take revenge against all the insults heaped upon him by the Christian merchant and moneylender Antonio:
"I hate him [Antonio] for he is a Christian,
But more for that in low simplicity
He lends out money gratis and brings down
The rate of usance here with us in Venice.
If I can catch him once upon the hip,
I will feed fat the ancient grudge I bear him.
He hates our sacred nation, and he rails,
Even there where merchants most do congregate,
On me, my bargains and my well-won thrift,
Which he calls interest. Cursed be my tribe,
If I forgive him!" Act I Sc.3.
So when he lends him three thousand ducats, he makes Antonio sign a bond stating that if he does not repay the money within the stipulated time he will have to allow Shylock to cut a pound of his flesh from any part of his body:
It so happens that Antonio is unable to repay the money within the stipulated time and Shylock gets ready to cut a pound of flesh from near his heart and thus seek his revenge. However he is saved at the nick of time by the clever Portia who insists that Shylock must take only one pound of Antonio's flesh but that he must not shed a single drop of his blood! In Act V Sc.1 Portia saves Antonio's life by reminding Shylock that while cutting a pound of flesh close to Antonio's heart he must not spill even a single drop of his blood:
"This bond doth give thee here no jot of blood;
The words expressly are 'a pound of flesh:'
Take then thy bond, take thou thy pound of flesh;
But, in the cutting it, if thou dost shed
One drop of Christian blood, thy lands and goods
Are, by the laws of Venice, confiscate
Unto the state of Venice."
This is how Portia defeats Shylock's evil intentions.