I have a business requirement to update / close an existing opportunity in Salesforce automatically. I have an existing script that extracts record from salesforce automatically using soql query and I am wondering if it is also possible to use SOQL to insert/update data in Salesforce.
No, SOQL (Salesforce Object Query Language) is a query language. It allows you to pull data from the database. If you want to push data to the database, you use DML (Database Manipulation Language) operations.
List<Opportunity> records = [SELECT Id FROM Opportunity WHERE ...]; // above is SOQL // set some fields... update records; // above is DML