Hi @Kripa Tharakan
If you are using an app-only context, then make sure you assign application permissions to the calling app, not delegated permissions. You also need to make sure you have granted admin consent for the permissions above.
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.