As a simple first start:
In TwinCAT-PLC, under Resources tab - Global Variables - Global_Variables, declare I/O variables:
VAR_GLOBAL
(* the variables below must be linked to I/O channels of each module in System Manager. When adding a new one, Rescan in System Manager to associate, otherwise a VAR_CONFIG warning *)
DI1 AT %I*: BOOL; (* digital in ch1, False = low, True = high*)
DO1 AT %Q*: INT; (* digital out ch1, False = off, True = on *)
AI1 AT %I*: INT; (* analog in ch1, -32768 to 32767 = -10 to +10 V *)
AO1 AT %Q*: INT; (* analog out ch1, -32768 to 32767 = -10 to +10 V *)
END_VAR
The "%I*" is a cryptic notation meaning an input variable and the exact memory location will be automatically specified later. You can also declare exact memory locations, as in old-fashioned PLC's, but that is tedious and error-prone. "Q" must mean output in German.
Next, use these variables in PLC code that executes every cycle. Under POUs tab - Main, enter Structured Text:
DO1 := DI1;
AO1 := 2 * AI1;
Save as "TestProject", then Project - Rebuild All.
In System Manager, start a new project w/ 1 ms cycle time.
Under "Route Settings", "Broadcast Search" for your PLC "brain" (might be on same PC), and set a "static" Route.
Under "IO Devices", right-click "Scan Devices", then "Scan Boxes", etc.
Under "IEC 1131", right-click "Scan Project" and select "TestProject.tpy" you built above.
Under "Standard - Inputs", dbl-click DI1 and AI1 and link to a real input channel. Select a terminal's channel "Value", not a status bit such. Ditto for "Outputs".
To make sure the I/O links work, view the "Online" tab and input voltages to the channels and force outputs (in "Free Run" mode).
To load your PLC code, in TwinCAT-PLC - Online - Login and select your PLC brain's "runtime". I recall you must set PLC to "run" mode in System Manager first, and perhaps use "Choose Run-time" first. Download the PLC code, then "Run". You can Logout or stay there to view PLC values. Create a "Boot Project" so it runs each time the PC boots up.
When you apply a voltage to DI1 channel, the DO1 channel should change to a high state. Whatever voltage you apply to AI1 channel, you should see double out of the AO1 channel.
This is all from memory and certainly some bugs and missing items above, but this is the general flow.