A CTE is just a part of a normal DML statement. It can be included with any SELECT, INSERT, UPDATE or DELETE statement.
You are going to have to show us what you attempted so we can identify where the problem is. The basic structure of a CTE is:
WITH cte (col1, col2)
AS (SELECT col1, col2 FROM sometable WHERE somecol = somevalue) -- this is the end of the CTE
SELECT col1, col2
FROM cte;
Now, the semi-colon is a statement terminator in SQL. It just denotes the end of a statement - and with a common table expression, the previous statement must be terminated using the semi-colon or it will not compile.
For example:
SET @var = 'somevalue'
WITH cte (...) AS (SELECT ...)
The above will fail because the previous statement was not terminated with a semi-colon.