You can not use external libraries inside of AppSync's JS resolvers. Here's a list of supported runtime features: https://docs.aws.amazon.com/appsync/latest/devguide/resolver-util-reference-js.html
One way of doing this would be to create a Lambda function (where you can install dynamoose), and then use AppSync JS resolver to invoke that function. See here: https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-lambda-resolvers-js.html