Every time you want to take a screenshot or capture your screen with Tasker you have to manually accept an Android system prompt. To avoid that you can run a one-time ADB command from your PC and allow Tasker forever!
Install the Tasker Permissions app and follow the prompts.
adb shell appops set net.dinglisch.android.taskerm
If you're on a mac write
allow./adb shell appops set net.dinglisch.android.taskerm
allow