The Confusion of Smart Contracts

Dear guy
Can a smart contract write data only by using the app_global_put opcode in the contract? Like this
byte “6”
byte “00:00:00:00:00:04 1 1 1”
app_global_put
Can I write the data via sdk?
If the function to read in data is readGlobalState, what is the function to write data in sdk

Only stateful smart contracts can write state. The sdks do support calling stateful contracts and you can also add up to 1kb note to any transaction using the sdks.