Hi @harishbp,
I have moved this question to a new topic. I recommend creating a new topic per question as it makes it easier for community members to answer, (and for future readers to find answers).
I assume that you have approved an allowance of DAI (Example on how to use ERC20 token in another contract).
Can you share how you are calling the function, is this via Solidity or JavaScript?