i was getting an error
You are using a wrong approach in your code . Try using another approach in your code.